[英]Qt Visual Studio Add-in project - cannot import Win32 DLL
I've installed these packages on my system: 我已经在系统上安装了这些软件包:
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.