我花了这个周末试图弄清楚这一点,并且我正走在最后一步。我的目标是:让visual studio 2010和Qt 4.7.3一起工作。Visual Studio 2010 Qt链接问题
我从源Qt安装,以指定要建立具有以下配置:
configure.exe -debug和释放-opensource -platform Win32的msvc2010 -no-webkit的-no声子-no - 声子-backend -no-script -no-scripttools -no-qt3support -no-multimedia -no-ltcg
配置完成后,我跑了nmake,没问题。
在我的visual studio 2010解决方案中,我有两个项目。 这是抱怨,它不能链接Qt库。在公共属性
AssetIO最初是使用Qt IDE构建的,我在Visual Studio中使用了Qt插件来导入项目。编译项目AssetIO工作得很好。但是,编译Short项目会导致以下链接器错误: 右键单击Short项目,选择属性。我添加了AssetIO作为参考。单击该配置属性,VC++目录,我有以下的包括添加的目录:
这里是库文件,我对项目: 而是然后发布更多屏幕截图,我包括目录AssetIO项目是: C:\ qt_source \ 4.7.3 \包括
为AssetIO项目我的图书馆目录是: C:\ qt_source \ 4.7.3 \ BIN
下面是简单的源代码我正在努力工作的项目克(我简单的测试项目)
main.cpp
int main(int argc, char* argv[])
{
AssetIO::LevelLoader a;
a.dostuff();
return 0;
}
LevelLoader.h
#ifndef LEVELLOADER_HPP
#define LEVELLOADER_HPP
namespace AssetIO
{
class LevelLoader {
public:
explicit LevelLoader();
~LevelLoader();
void dostuff();
};
}
#endif // LEVELLOADER_HPP
LevelLoader.cpp
#include "LevelLoader.hpp"
#include <QDomDocument>
#include <QFile>
#include <QDebug>
#include <QString>
using namespace AssetIO;
enum ComponentType { Drawable = 0, Position };
// This will definitely be changed, to return a full-blown component. Passing the tagname directly to the
// component factory.
ComponentType ConvertToComponentType(QString tagName)
{
if(tagName.toLower() == "Drawable") {
return Drawable;
}
else if(tagName.toLower() == "Position") {
return Position;
}
else {
// LOG
exit(EXIT_FAILURE);
}
}
LevelLoader::LevelLoader()
{
}
LevelLoader::~LevelLoader()
{
}
void LevelLoader::dostuff()
{
QDomDocument doc("la");
QFile file("../../../Resources/input.sto");
if(!file.open(QIODevice::ReadOnly)) {
// TODO: log this, something
exit(EXIT_FAILURE);
}
if(!doc.setContent(&file)) {
// TODO: log
file.close();
}
// we close the file now the doc has control (i think)
file.close();
// Read the root element
QDomElement root = doc.documentElement();
if(root.tagName() != "Root") {
// TODO: log
exit(EXIT_FAILURE);
}
// Read the Header Info
QDomNode headerNode = root.firstChild();
QDomElement e = headerNode.toElement();
if(e.tagName().toLower() != "HeaderInfo") {
// LOG
}
QDomNodeList componentNode = headerNode.childNodes();
int s = componentNode.count();
QString componentTag(componentNode.at(0).toElement().tagName());
QDomNamedNodeMap a = componentNode.at(0).attributes();
}
我想不出我在做什么错误。有没有人有任何想法?我到处寻找解决方案。
我通过使用命令参数运行qmake来实现它,你的意思是从命令行正确吗?我打算使用Qt作为编辑器,这非常好。我只是想在visual studio 2010中调试exe时能够进入我的assetIO项目。 – Short