2012-05-25 53 views
-1

這是我第一次使用opencv。我下載了它,並設置在Visual Studio 2010(專業)包括目錄,像這樣:編譯opencv簡單程序的結果與windows sdk衝突

C:\opencv\build\include\opencv 
C:\opencv\build\include 

的「繼承」的值是:

$(VCInstallDir)include 
$(VCInstallDir)atlmfc\include 
$(WindowsSdkDir)include 
$(FrameworkSDKDir)\include 

但是我編譯時獲得有關Windows SDK的錯誤。 ..

1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h(212): error C2011: 'sockaddr' : 'struct' type redefinition 
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(485) : see declaration of 'sockaddr' 
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h(390): error C2059: syntax error : 'constant' 
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h(443): error C2143: syntax error : missing ';' before '}' 
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h(443): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h(443): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h(524): warning C4005: 'IN_CLASSA' : macro redefinition 
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(287) : see previous definition of 'IN_CLASSA' 
... 

與sdk包含文件存在一些衝突。有誰知道我該如何解決這個問題? 謝謝

+0

可能的[OpenCV 2.3 C++ Visual Studio 2010]的副本(http://stackoverflow.com/questions/7011238/opencv-2-3-c-visual-studio-2010) – karlphillip

+0

它是不。我讀過那個線程,它是完全不相關的...... – Cornwell

+0

如果你不包含OpenCV頭文件/代碼,會發生這個錯誤嗎? – karlphillip

回答

1

正在使用winsock2.h並且由於某種原因與opencv發生衝突。將其更改爲winsock.h

+0

是否像opencv和winsock不能一起工作? –