2014-04-06 7 views
7

Co może powodować takie błędy? Dodałem pusty projekt do Xcode, dodałem/usr/local/lib w Header Search Paths i dodałem kilka bibliotek opencv. Budynek dał te błędy:Błędy w cstdint: Brak elementu o nazwie xxx w globalnej przestrzeni nazw

UPDATE

Wydaje stdint.h rzeczywiście jest zainstalowany w moim systemie. Używam systemu OS 10.9, więc typy takie jak int_least16_t, które xcode nie może znaleźć w globalnej przestrzeni nazw, wydają się być zdefiniowane.

typedef int16_t int_least16_t;.

find /Applications/Xcode.app -name stdint.h 
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/usr/include/c++/4.2.1/tr1/stdint.h 
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/usr/include/stdint.h 
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/usr/include/c++/4.2.1/tr1/stdint.h 
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/usr/include/stdint.h 
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/stdint.h 
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/c++/4.2.1/tr1/stdint.h 
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/stdint.h 
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/stdint.h 
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/tr1/stdint.h 
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/stdint.h 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include/stdint.h 
+0

Czy masz również włączoną obsługę C++ 11? – lpapp

+0

Tak, używam biblioteki standardowej C++, której używam to libC++ (standardowa biblioteka LLVM C++ z obsługą C++ 11). Używam również języka C++ Language Dialect GNU ++ 11. Te same błędy występują podczas używania dialektu, C++ 11. Upewniłem się, że kompilator, którego używam (Apple LLVM 5.1) rzeczywiście używa tych opcji. –

+0

Czy zweryfikowałeś, że naprawdę masz 'stdint.h' zainstalowany w twoim systemie i że te typy są zadeklarowane w nim? – Amadeus

Odpowiedz

8

Dzięki @ n.m., Dowiedziałem się, że instalowania czegokolwiek bezpośrednio pod /usr/local jest fundamentalnie uszkodzony z powodu kolejnych wersji piekła. Prawdopodobnie miałem pewne źródło zła w /usr/local/include, więc kiedy zastąpiłem usr/local/include z /usr/local/Cellar/opencv/2.4.8.2/include/opencv2 (ponieważ zainstalowałem opencv używając brew) w Xcode > Build Settings > Header Search Paths (z rekurencyjną True) wszystko działało.

Powiązane problemy