我想实现一个程序,可以使用Assimp(link of Assimp)将3D模型加载到OpenGL中。程序在使用Assimp编译和执行Qt5项目时崩溃了
我的Qt版本是5.3.2。 我使用Qt Creator和修改.pro
文件导入Assimp库:
INCLUDEPATH += H:\Study\assimp-3.1.1-win-binaries\assimp-3.1.1-win-binaries\include\assimp
LIBS += -lH:\Study\assimp-3.1.1-win-binaries\assimp-3.1.1-win-binaries\lib32\assimp
然后我试着在我的程序读取box.obj
:
#include <scene.h>
#include <postprocess.h>
#include <Importer.hpp>
int main(){
Assimp::Importer importer;
const aiScene* scene = importer.ReadFile("box.obj", NULL);
if (!scene)
{
qDebug() << "Error loading file: (assimp:) " << importer.GetErrorString();
return false;
}
.....// Other code to create a window
return 0;
}
然后编译完成没有错误。 然后程序刚刚启动后崩溃。
Starting G:\QtProject\QtTest\build-MyOpenGL-Desktop_Qt_5_3_MSVC2010_OpenGL_32bit-Debug\debug\MyOpenGL.exe...
G:\QtProject\QtTest\build-MyOpenGL-Desktop_Qt_5_3_MSVC2010_OpenGL_32bit-Debug\debug\MyOpenGL.exe crashed
我尝试调试但断点看起来不起作用。
我删除一些代码,只需要声明scene
:
#include <scene.h>
#include <postprocess.h>
#include <Importer.hpp>
int main(){
//Assimp::Importer importer;
const aiScene* scene; // = importer.ReadFile("box.obj", NULL);
/*if (!scene)
{
qDebug() << "Error loading file: (assimp:) " << importer.GetErrorString();
return false;
}*/
.....// Other code to create a window
return 0;
}
程序可以再次运行!
我现在很困惑。谁能帮我?
我的编译器是微软的Visual C++编译器10.0 – Paler 2014-11-06 13:42:34