的main.cpp如何解決未定義的參考`b2World :: b2World(b2Vec2常量&)」
#include <iostream>
#include <Box2D/Box2D.h>
int main() {
int32 velocityIterations = 6;
int32 positionIterations = 2;
b2Vec2 gravity(0.0f, -10.0f);
b2World world(gravity);
std::cout << "Hello, world!" << std::endl;
}
的錯誤,我得到:
未定義的參考`b2World :: b2World(b2Vec2常量&)」
當我嘗試的CMakeLists.txt鏈接的Box2D:
include_directories(C:/Users/blahblah/CPPLibs)
target_link_libraries(HelloWorld Box2D)
我得到:
C:/ MinGW的/ bin中/../ lib中/ GCC/x86_64的-W64-的mingw32/6.1.0 /../../../../ x86_64的-w64-mingw32/bin/ld.exe:找不到-lBox2D
如何正確導入Box2D到我的項目?
創建b2World構造函數 –
@MichelJord我做了'b2World world(gravity);',怎麼了? –