我目前在我的程序中使用了一个向量,但是在开始使用这个类之后,出现了一些奇怪的错误。
这些错误包括:
1>MyCloth.obj : error LNK2019: unresolved external symbol __CrtDbgReportW referenced in function "public: unsigned int & __thiscall std::vector<unsigned int,class std::allocator<unsigned int> >::operator[](unsigned int)" (??A?$vector@IV?$allocator@I@std@@@std@@QAEAAII@Z)
1>libcpmtd.lib(stdthrow.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>D:\Licenta\Project\IOPBTS\Debug\IOPBTS.exe : fatal error LNK1120: 1 unresolved externals
我的代码如下:
在头文件中:
#undef vector
#include <vector>
void findPieceVertices(NxU32 selectedVertex);
bool checkVertexExistsInClothPieceElements(int vertex);
void findVertexTriangles(NxU32 vertex);
std::vector<NxU32> clothPieceElements;
在cpp文件中:
bool MyCloth::checkVertexExistsInClothPieceElements(int vertex)
{
for(int i=0;i<clothPieceElements.size();i++)
if(clothPieceElements[i]==vertex)
return true;
return false;
}
void MyCloth::findVertexTriangles(NxU32 vertex)
{
NxMeshData data = mCloth->getMeshData();
NxU32* vertices = (NxU32*)data.indicesBegin;
NxU32 aux = 0;
for(int i=0;i<(mInitNumVertices-1)*3;i+=3)
{
if(*vertices == vertex || *(vertices+1) == vertex || *(vertices+2) == vertex)
{
if(!checkVertexExistsInClothPieceElements(*vertices))
clothPieceElements.push_back(*vertices);
if(!checkVertexExistsInClothPieceElements(*(vertices+1)))
clothPieceElements.push_back(*(vertices+1));
if(!checkVertexExistsInClothPieceElements(*(vertices+2)))
clothPieceElements.push_back(*(vertices+2));
}
vertices = vertices + 3;
}
}
void MyCloth::findPieceVertices(NxU32 selectedVertex)
{
clothPieceElements.push_back(selectedVertex);
int i=0;
while(i<clothPieceElements.size())
{
findVertexTriangles(clothPieceElements[i]);
i++;
}
}
我到底做错了什么?我在网上找到一些资料,说我使用的文件是在发布模式下编译的,我也应该这样做。问题是,如果我在发布模式下编译,这些错误就会消失,但我的程序无法找到一个非常重要的非C库,它被指向了VCC Directories->Include directories中添加的路径。
有人知道为什么会出现这个错误吗?或者它意味着什么?
另外,有人能告诉我在调试模式和发布模式下构建的区别吗?