2013-05-02 70 views
2

我想在Visual Studio 2012中使用OpenNI構建一個.cpp文件。我使用SimpleViewer樣本(它包含在OpenNI中)的代碼。當我嘗試構建.cpp文件時,得到了編譯器必須鏈接OpenNI庫時出現的錯誤LNK2019,這似乎是一個問題。什麼可能是錯的?錯誤LINK2019使用OpenNI和Visual Studio

錯誤(總共55):

> Error 1 error LNK2019: unresolved external symbol __imp__oniShutdown 
> referenced in function "public: static void __cdecl 
> openni::OpenNI::shutdown(void)" 
> ([email protected]@[email protected]@SAXXZ) C:\Develop\VisualStudioWorkspace\Projects\My 
> programs\OpenNI2_test\OpenNI2_test\Viewer.obj OpenNI2_test 
Error 2 error LNK2019: unresolved external symbol __imp__oniWaitForAnyStream referenced in function "public: static enum openni::Status __cdecl openni::OpenNI::waitForAnyStream(class openni::VideoStream * *,int,int *,int)" ([email protected]@[email protected]@[email protected]@[email protected]@[email protected]) C:\Develop\VisualStudioWorkspace\Projects\My programs\OpenNI2_test\OpenNI2_test\Viewer.obj OpenNI2_test 

我跟着OpenNI website描述編譯在Visual Studio中的文件的所有步驟:我添加了所有的VCC目錄和include和lib環境變量。我還在鏈接器部分的附加依賴項中添加了OpenNI2.lib。我還在工作目錄(我有.vcproj的目錄)中複製了Redist文件。

+0

有解決方案,請檢查這個[問題] [1] 也許它適用於您的情況! [1]:http://stackoverflow.com/questions/14644191/openni-2-and-visual-studio-2012/15078460#15078460 – NKN 2013-08-08 10:31:14

回答

3

我遇到了類似的問題。示例項目不會生成,因爲我使用OpenNI for x64,但平臺設置爲Win32。更改爲x64(在頂部的屬性對話框中)爲我解決了它。

0

OpenNI 2.0還不夠成熟。大多數庫,開源代碼,示例和包裝器仍然使用OpenNI 1.5。由於OpenNI2使用Microsoft官方驅動程序,而OpenNI1.x使用開源驅動程序,所以整合並不容易。 32位版本的問題比64位的問題少,但我最終安裝並使用了OpenNI 1.5和Kinect非官方驅動程序。

0

該問題與鏈接過程有關。您的項目屬性中可能有錯誤的鏈接路徑。有解決方案,檢查這個question 也許它適用於你的情況!