编译时找不到Qt文件 [英] Cannot find Qt files when compiling

查看:1431
本文介绍了编译时找不到Qt文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个QT项目,最初设计为用于UI以及为网络创建服务器。但是,现在我只需要它的网络部分与另一个UI实现集成。

I've a QT project that was initially designed both for UI as well as creating a server for the network. However, now I only need the network part of it to integrate with another UI implementation.

我删除了文件和main函数,并将项目编译为库。一切都很好。

I stripped out the files and main function and compile the project as a library. All goes well.

但是,当我试图将一个头文件包含在这个项目中的另一个项目,我得到这样的编译时错误来自QT项目的文件):

However, when I try to include a header file from this project into another project, I get compile time errors like these (for the project that calls header files from QT project):

fatal error C1083: Cannot open include file: 'QObject': No such file or directory

这两个项目都是同一个VS2008解决方案的一部分。

Both projects are part of the same VS2008 solution. I think I'm missing something, but cannot put my hands on it... Please help, thnx!

推荐答案

好吧,都是固定的。感谢@ Petr-Budnik的建议。这是我做的...

Alright, is all fixed. Thanks @Petr-Budnik for the suggestions. Here is what I did...


  1. 设置环境值(在Config properties-> debugging下)更新路径它在QT项目中完成)。

  2. 将所有预处理器定义从QT项目复制到主项目

  3. 更新包含路径

  4. 在出现链接错误时,添加其他依赖关系中的QT .lib文件。

  1. Set the environment values (under Config properties->debugging) to update the path (this is how it was done in QT project). This value was setting path to include QTBin folder (which I suspect has any use)
  2. Copied all the Preprocessor definitions from QT project to the main project
  3. Update the include paths
  4. Add QT .lib files in additional dependencies when stuck with Linking errors.

一个重要的(虽然奇怪)编译期间修复...我不得不移动调用包括这个Qt项目文件到我的.h的顶部,由于一些奇怪的QT编译时错误从文件qnamespace.h和qmetatype.h(感谢提示从评论2

And an important (though weird) fix during compiling... I had to move the call to include this Qt project file to the top of my ".h" due to some weird QT compile time errors from file qnamespace.h and qmetatype.h (Thanks to the tip from comment 2)

这篇关于编译时找不到Qt文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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