简体   繁体   English

Qt Visual Studio加载项项目-无法导入Win32 DLL

[英]Qt Visual Studio Add-in project - cannot import Win32 DLL

I've installed these packages on my system: 我已经在系统上安装了这些软件包:

  • Qt 5.3.1 for Windows 32-bit (VS 2013, OpenGL, 557 MB) 适用于Windows 32位的Qt 5.3.1(VS 2013,OpenGL,557 MB)
  • Visual Studio Add-in 1.2.3 for Qt5 Qt5的Visual Studio加载项1.2.3

I want to use my Win32 DLL that contains background logic for my Qt application. 我想使用包含Qt应用程序后台逻辑的Win32 DLL。 What I've done is included the headers in C++ -> General -> Additional Include Directories and referenced the DLL file in Common Properties -> References. 我所做的是在C ++->常规->其他包含目录中包含标头,并在通用属性->引用中引用了DLL文件。 This method worked fine with a Win32 console application I used for testing prior to creating the Qt project under the same solution. 在同一个解决方案下创建Qt项目之前,该方法与我用于测试的Win32控制台应用程序配合良好。 I've also tried the Copy Local option (VS reverts it back to "False" every time, for some reason) and putting the path of the directory that contains the .lib file in Linker -> General -> Additional Library Directories, that file was then included in Linker-> Input -> Additional Dependencies. 我还尝试了“复制本地”选项(由于某种原因,VS每次都会将其还原为“ False”),并将包含.lib文件的目录的路径放在链接器->常规->其他库目录中,然后,文件包含在链接器->输入->其他依赖关系中。 Nothing seems to work. 似乎没有任何作用。 The code should supposedly be ABI-compliant since everything was compiled using MSVC. 由于所有内容都是使用MSVC编译的,因此该代码应该符合ABI。 I've also read this question - maybe it has something to do with that? 我也读过这个问题 -也许与此有关吗?

All of the public methods in the DLL project were exposed with a __declspec(dllexport) prefix. DLL项目中的所有公共方法都使用__declspec(dllexport)前缀公开。 I haven't used the extern "C" part nor BOOL APIENTRY DllMain like in this question . 我没有在这个问题中使用extern“ C”或BOOL APIENTRY DllMain。

The error that pops up when I try to run the project: 当我尝试运行项目时弹出的错误: 错误

EDIT: I've now tried changing the Qt app's build output folder to that of the DLL project. 编辑:我现在尝试将Qt应用程序的生成输出文件夹更改为DLL项目的。 It does run now (only through VS), but upon exiting it throws an access violation exception concerning the Qt5Widgetsd.dll library: 它确实可以立即运行(仅通过VS),但是退出后会引发与Qt5Widgetsd.dll库有关的访问冲突异常:

Problem signature:
  Problem Event Name:   BEX
  Application Name: RagingSeasGUI.exe
  Application Version:  0.0.0.0
  Application Timestamp:    53fccbaa
  Fault Module Name:    Qt5Widgetsd.dll
  Fault Module Version: 5.3.1.0
  Fault Module Timestamp:   53a2bfdb
  Exception Offset: 0052f2b4
  Exception Code:   c0000005
  Exception Data:   00000008
  OS Version:   6.1.7601.2.1.0.256.1
  Locale ID:    1050
  Additional Information 1: 0a9e
  Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
  Additional Information 3: 0a9e
  Additional Information 4: 0a9e372d3b4ad19135b953a78882e789

Solved by changing the Qt project's build output folder to the same one as the DLL project's: Configuration Properties -> General -> Output Directory. 通过将Qt项目的生成输出文件夹更改为与DLL项目相同的文件夹来解决:配置属性->常规->输出目录。 Still don't understand why Visual Studio won't let me use the "Copy Local" option. 仍然不明白为什么Visual Studio不会让我使用“复制本地”选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 “没有为 Win32 平台分配给这个项目的 Qt 版本” - Qt 的 Visual Studio 插件 - "There's no Qt version assigned to this project for platform Win32" - visual studio plugin for Qt 如何在Win32 C ++项目Visual Studio 2010中使用ActiveX dll - How to use ActiveX dll in win32 C++ project visual studio 2010 在两个Visual Studio 2010 C ++项目(DLL和Win32项目)中共享头文件 - Share header files within two Visual Studio 2010 C++ projects ( DLL and a Win32 project) 在Visual Studio 2008中设置Win32 DLL - Setting Up a Win32 DLL in Visual Studio 2008 在Visual Studio 2010中将项目从Win32移植到x64平台后加载了错误的ComCtl32.dll - Incorrect ComCtl32.dll is loaded after porting a project from Win32 to x64 platform in Visual Studio 2010 如何在Win32 Project,Visual Studio 2010中添加控制台窗口 - How to add console window in Win32 Project, Visual Studio 2010 将WIN32控制台项目模板添加到Visual Studio Community 2017 15.5.2吗? - Add WIN32 Console Project Template To Visual Studio Community 2017 15.5.2? 针对Windows 2000的Visual Studio 2012 Win32项目 - visual studio 2012 win32 project targeting windows 2000 Visual Studio:如何在“Win32”项目中获取输出 - Visual Studio: how to get output in “Win32” project 向安装项目Win32应用程序Visual Studio添加依赖项 - Adding dependencies to a setup project Win32 application Visual Studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM