简体   繁体   English

Qt,Qmake和Visual Studio 2013

[英]Qt, Qmake and Visual Studio 2013

I'm currenlty working on a portable project. 我目前正在从事便携式项目。 To make it easier to compile on linux and windows, I'd like to use a .pro file which will generate a Makefile on linux and a visual studio project on windows. 为了使在Linux和Windows上编译更容易,我想使用一个.pro文件,它将在Linux上生成一个Makefile,在Windows上生成一个Visual Studio项目。

But, I'm facing a problem on a very basic example. 但是,我在一个非常基本的示例上面临一个问题。

Here is my .pro file: 这是我的.pro文件:

TEMPLATE        = app
TARGET          = client
CONFIG          += debug
SOURCES         += src/main.cpp

My main.cpp only contains an empty main: 我的main.cpp只包含一个空的main:

int main(void) { return 0; }

Then, I just open my visual studio console, cd in my project folder and run qmake.exe -spec win32-msvc2013 -tp vc . 然后,我只需打开Visual Studio控制台,在项目文件夹中cd并运行qmake.exe -spec win32-msvc2013 -tp vc

This generates the expected vcxproj file, that I can open with visual studio. 这将生成预期的vcxproj文件,可以使用Visual Studio打开该文件。

The program compiles well with visual, but I got a fail during the execution: Qt5Cored.dll missing . 该程序在视觉上可以很好地编译,但是在执行过程中失败了: Qt5Cored.dll missing

I've verified: 我已验证:

  • In the project properties, Qt lib directory has been added to the libraries directories 在项目属性中,Qt lib目录已添加到库目录中
  • Qt5Cored.dll exists (and is located in the Qt lib directory) Qt5Cored.dll存在(位于Qt lib目录中)
  • I'm compiling and executing in debug environment 我正在调试环境中编译和执行

Additionnal information: 附加信息:

  • Qt is well installed Qt安装正确
  • When I create a Qt5 project via visual studio, it works well (but this is not what I want). 当我通过Visual Studio创建Qt5项目时,它运行良好(但这不是我想要的)。

When I manually import the .pro file using the Qt add-in, the vcxproj generated works well (no error during the execution): what's the difference? 当我使用Qt加载项手动导入.pro文件时,生成的vcxproj运行良好(执行期间无错误):有什么区别? why the qmake doesn't work, but manual import does? 为什么qmake不起作用,而手动导入却起作用? Have I missed something to make the qmake work? 我是否错过了一些使qmake正常工作的东西?

As someone has said in the comments of my question, the solution is pretty simple: I just needed to add the Qt bin path to the Windows PATH environment variable. 正如有人在对我的问题的评论中说的那样,解决方案非常简单:我只需要将Qt bin路径添加到Windows PATH环境变量即可。

Problem solved :) 问题解决了 :)

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM