2013-01-23 38 views
0

我試圖通過MinGW生成RecastNavigation,似乎一切都很好,除了RecastDemo應用程序。建立重新導航下明暗

我做:

cmake -G"MSYS Makefiles" -DSDL_INCLUDE_DIR:PATH=/c/_libdist/x86/msys/include/SDL \ 
-DSDL_LIBRARY:PATH=/c/_libdist/x86/msys/lib/libSDL.a \ 
-DSDLMAIN_LIBRARY:PATH=/c/_libdist/x86/msys/lib/libSDLMain.a .. 

然後使VERBOSE = 1給我這個末(切出取消定義的一串):

cd /C/_lib/blackberry/RecastNavigation/build.msys/RecastDemo && /C/app/MinGW/bin/g++.exe -O3 -DNDEBUG -mwindows -Wl, 
--whole-archive CMakeFiles/RecastDemo.dir/objects.a -Wl,--no-whole-archive -o ../../RecastDemo/Bin/RecastDemo.exe -Wl,- 
-out-implib,../../RecastDemo/Bin/libRecastDemo.dll.a -Wl,--major-image-version,0,--minor-image-version,0 ../DebugUtils/ 
libDebugUtils.a ../Detour/libDetour.a ../DetourCrowd/libDetourCrowd.a ../DetourTileCache/libDetourTileCache.a ../Recast/ 
libRecast.a /c/_libdist/x86/msys/lib/libSDL.a /c/_libdist/x86/msys/lib/libSDLMain.a -lglu32 -lopengl32 -lkernel32 -luser 
32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 
Creating library file: ../../RecastDemo/Bin/libRecastDemo.dll.a 
c:/_libdist/x86/msys/lib/libSDL.a(SDL_systimer.o): In function `SDL_StartTicks': 
c:\_lib\SDL\1.2.15/./src/timer/win32/SDL_systimer.c:67: undefined reference to `[email protected]' 
c:\_lib\SDL\1.2.15/./src/timer/win32/SDL_systimer.c:68: undefined reference to `[email protected]' 
c:/_libdist/x86/msys/lib/libSDL.a(SDL_systimer.o): In function `SDL_GetTicks': 
... 
... 
... 
c:/app/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../libmingw32.a(main.o): In function `main': 
C:\MinGW\msys\1.0\src\mingwrt/../mingw/main.c:73: undefined reference to `[email protected]' 
collect2: ld returned 1 exit status 
make[2]: *** [../RecastDemo/Bin/RecastDemo.exe] Error 1 

我不知道在哪裏探索更多的庫順序似乎是正確的。我在這裏錯過了什麼?

回答

1

問題是你缺少一個鏈接庫,在這種情況下,mingw32。修復它的最簡單方法是告訴CMake在哪裏可以找到SDL。您可以通過設置SDLDIR環境變量來完成此操作(請參閱http://cmake.org/cmake/help/v2.8.10/cmake.html#module:FindSDL)。因此,根據您的SDL安裝位置,從你的MinGW提示:

export SDLDIR=/c/_libdist/x86/msys 

然後運行CMake的:

cmake -G "MSYS Makefiles" .. 

這應該找到SDL並設置SDL包括目錄和鏈接庫正確。

但是,CMake中存在一個錯誤,它以錯誤順序將庫傳遞給鏈接器,請參閱http://public.kitware.com/Bug/view.php?id=13769。該錯誤已得到修復,但尚未在最新版本中發佈(2.8.10.2)。

,直到有新的CMake釋放你能做的就是編輯CMakeCache.txt緩存 SDL_LIBRARY值在你的build目錄,並切換 的SDL庫的順序左右,然後再次運行CMake的東西。