Visual Studio编译Qt代码报告LNK2019 [英] Visual Studio compiling Qt code report LNK2019

查看:169
本文介绍了Visual Studio编译Qt代码报告LNK2019的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。



我正在研究一个项目的模块。由于UI是使用Qt(由我小组中的其他人)创建的,因此我必须使用类似 QString QDir 依此类推。但是我想使用VS而不是QtCreator进行编码,因为我没有绘制UI。



我下载了最新的Qt 5.5开源版本适用于Windows的网站。它的根文件夹是 D:\ Qt \ .5.5 \msvc2013_64 。在里面我找到了lib文件夹,里面有很多。lib文件和include 包含相关标题的文件夹。所以我把它们都导入了我的VS项目。我将Qt5Cored.lib添加到我的VS项目的附加依赖项链接器选项中。 />


我写了一个非常简单的测试,看看这个配置是否有效。 (使用 QString QDir )。



但是链接器在 QString :: QString QDir :: setPath LNK2019 c $ c>和许多其他Qt的东西。



我做错了什么或者我没有加载项在VS中无法进行Qt编码?



提前谢谢!

解决方案

因为您正在以组的形式处理项目,所以每个人都应该拥有相同的开发设置。所以我会问你的同事如何设置他的Qt安装并帮助你在你的机器上做同样的事情。然后你应该没有问题。



如果你还想手动设置,请继续阅读。



如果他没有使用预构建的Qt版本,但已经编译了它,你必须使用他构建的头文件和库,或者使用相同的设置在你的机器上构建它们。



如果他使用预构建的Qt版本,则必须安装包含库,DLL和头文件的该版本的相同开发版本。不构建Qt时不要使用Qt源。原因是Qt有很多构建选项,可以创建所有其他头文件包含的构建特定包含文件( qconfig.h )。


我会直接去qt论坛。



找到谷歌搜索:

http://stackoverflow.com/questions/32757202/getting-lots-of-linker- errors-when-changed-the-qt-projects-build-directory [ ^ ]



和: https://forum.qt.io/topic/2941/failed-to-link -against-qstring-fromstdwstring-tostdwstring [ ^ ]

Qt示例的VC项目必须将将wchar_t视为内置类型设置为false 。

Hi, everybody.

I'm currently working on a module of a project. Since the UI is created using Qt (by another fellow in my group), so I have to use classes like QString and QDir and so on. But I'd like to use VS instead of QtCreator to do the coding since I'm not drawing the UI.

I downloaded the latest Qt 5.5 open-source version for Windows from its website. Its root folder is D:\Qt\5.5\msvc2013_64. Inside I found the "lib" folder with many ".lib" files and "include" folder with relevant headers. So I imported both of them into my VS project. And I added the "Qt5Cored.lib" to my VS project's "Additional Dependencies" option of the linker.

I wrote a very simple test to see if this configuration works. (Using QString and QDir).

But the linker constantly report LNK2019 on QString::QString and QDir::setPath and many other Qt's stuff.

What am I doing wrong or I simply can't do Qt-coding in VS without an add-in?

Thanks in advance!

解决方案

Because you are working on the project as group everybody should have the same development setup. So I would ask your fellow how he setup his Qt installation and help you doing the same on your machine. Then you should have no problems.

Read on if you still want a manual setup.

If he is not using a pre-build Qt version but had compiled it, you must use the header files and libraries build by him or build them on your machine using the same settings.

If he uses a pre-build Qt version you must install the same development version of that build containing the libraries, DLLs and header files. Don't use the Qt sources when not building Qt. The reason is that Qt has a lot of build options that will create build specific include files (qconfig.h) that are included by all other header files.


I would go directly to the qt forums.

A google search found:
http://stackoverflow.com/questions/32757202/getting-lots-of-linker-errors-when-changed-the-qt-projects-build-directory[^]

and: https://forum.qt.io/topic/2941/failed-to-link-against-qstring-fromstdwstring-tostdwstring[^]
"VC project of Qt examples had to set "Treat wchar_t as Built-in Type" to false."


这篇关于Visual Studio编译Qt代码报告LNK2019的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆