EDIT2 : 문제는 간단한 입력 오류가 아닙니다입니다. 아래의 로그에서 오타를 만들었지 만 문제는 여전히있었습니다.C++ 프로그램을 컴파일 할 수 없습니다. 오류 : 알 수없는 형식 이름 'uint8_t'
EDIT : g ++ 대신 gcc로 잘못 실행했습니다. 아래에서 시도한 후 한 번. 문제는 이전에 g ++와 함께 있었고 현재 있습니다.
현재 MacOS High Sierra 상자에 있습니다. 필자는 최근 MacBook Air에서이 컴퓨터로 많은 파일을 옮겼습니다. 여기에는 Xcode의 모든 정크가 포함됩니다. 지금 때 나는 아주 간단한 C++ 프로그램을 컴파일하려고 :
[email protected]: [config_file_script] $ g++ test.cpp -o test
In file included from test.cpp:1:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/iostream:38:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/ios:216:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/__locale:15:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/string:470:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/string_view:171:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/__string:56:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/algorithm:640:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/memory:629:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/typeinfo:61:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/exception:82:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/cstdlib:86:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/stdlib.h:94:
In file included from /usr/include/stdlib.h:65:
In file included from /usr/include/sys/wait.h:110:
/usr/include/sys/resource.h:196:2: error: unknown type name 'uint8_t'
uint8_t ri_uuid[16];
^
/usr/include/sys/resource.h:197:2: error: unknown type name 'uint64_t'
uint64_t ri_user_time;
^
/usr/include/sys/resource.h:198:2: error: unknown type name 'uint64_t'
uint64_t ri_system_time;
^
/usr/include/sys/resource.h:199:2: error: unknown type name 'uint64_t'
uint64_t ri_pkg_idle_wkups;
^
/usr/include/sys/resource.h:200:2: error: unknown type name 'uint64_t'
uint64_t ri_interrupt_wkups;
^
/usr/include/sys/resource.h:201:2: error: unknown type name 'uint64_t'
uint64_t ri_pageins;
^
/usr/include/sys/resource.h:202:2: error: unknown type name 'uint64_t'
uint64_t ri_wired_size;
^
/usr/include/sys/resource.h:203:2: error: unknown type name 'uint64_t'
uint64_t ri_resident_size;
^
/usr/include/sys/resource.h:204:2: error: unknown type name 'uint64_t'
uint64_t ri_phys_footprint;
^
/usr/include/sys/resource.h:205:2: error: unknown type name 'uint64_t'
uint64_t ri_proc_start_abstime;
^
/usr/include/sys/resource.h:206:2: error: unknown type name 'uint64_t'
uint64_t ri_proc_exit_abstime;
^
/usr/include/sys/resource.h:210:2: error: unknown type name 'uint8_t'
uint8_t ri_uuid[16];
^
/usr/include/sys/resource.h:211:2: error: unknown type name 'uint64_t'
uint64_t ri_user_time;
^
/usr/include/sys/resource.h:212:2: error: unknown type name 'uint64_t'
uint64_t ri_system_time;
^
/usr/include/sys/resource.h:213:2: error: unknown type name 'uint64_t'
uint64_t ri_pkg_idle_wkups;
^
/usr/include/sys/resource.h:214:2: error: unknown type name 'uint64_t'
uint64_t ri_interrupt_wkups;
^
/usr/include/sys/resource.h:215:2: error: unknown type name 'uint64_t'
uint64_t ri_pageins;
^
/usr/include/sys/resource.h:216:2: error: unknown type name 'uint64_t'
uint64_t ri_wired_size;
^
/usr/include/sys/resource.h:217:2: error: unknown type name 'uint64_t'
uint64_t ri_resident_size;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
내가 설치하고 난 문제와 관련이 생각할 수있는 모든 것을 다시 설치 시도했다 :
#include <iostream>
int main()
{
// VAR_DEC
int a = 4;
// VAR_MANIP
a = a*2;
// VAR_PRINT
std::cout << a << std::endl;
return 0;
}
을 나는 다음과 같은 말도 안되는 오류
-
: 등
- JT Bullitt's very comprehensive blog
gcc
,
g++
,
cc
,
brew
, 엑스 코드,
command-line-tools
, 나는 또한 다음 페이지에있는 모든 제안을 시도했습니다
더
나는 the last one이 가장 가능성있는 해결책이라고 생각합니다. (당신은 페이지의 "알"을 검색하면 수정 프로그램을 볼 수 있습니다.) 개발자에 따르면
Fix: Remove /opt/local/include/** and /opt/local/lib/** from the "Header Search Paths" build settings. Replace them with much more specific paths to the desired include directories. In my particular case, this meant replacing them with /opt/local/include/glib-2.0 /opt/local/lib/glib-2.0/include /opt/local/include/. It's up and running again!
을하지만, 내가 엑스 코드를 설치하지 않은, 난 단지 명령 줄 개발자 도구를 설치했습니다. 따라서 "헤더 검색 경로"빌드 설정에 액세스 할 수있는 쉬운 방법이 없으므로 솔루션을 사용해 볼 수 없습니다.
이 문제에 대한 해결책을 찾고 있는데, 전체 운영 체제를 설치하지 않아도되는 것이 좋습니다. 또는 빌드 설정 파일을 찾음으로써 누군가 나를 친절하게 안내 할 수 있다면 매우 감사하게 생각합니다.
설명은 확장 토론이 아닙니다. 이 대화는 [채팅으로 이동되었습니다] (http://chat.stackoverflow.com/rooms/162198/discussion-on-question-by-joseph-farah-cannot-compile-any-c-programs-error-u) . –