g++ 컴파일 에러
안녕하세요.
Ubunutu 9.04, 64비트 운영체계를 깔아서 사용하고 있습니다.
g++ 버전은 다음과 같습니다
origin:$ g++ --v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.1-4ubuntu9' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --disable-werror --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu9)
-------------- 첨부한 화일을 컴파일 하면 다음과 같은 에러가 납니다.
origin:~/granular/simple_sphere$ make
g++ -c -Wall -O3 common.sphere.cpp -o common.sphere.o
common.sphere.cpp: In function ‘int main(int, char**)’:
common.sphere.cpp:64:11: error: ‘exit’ was not declared in this scope
common.sphere.cpp: In function ‘void init_system(char*)’:
common.sphere.cpp:149:13: error: ‘abort’ was not declared in this scope
make: *** [common.sphere.o] 오류 1
-------------- 32비트 Ubunutu 를 설치한 컴퓨터에서 컴파일을 하면 잘 됩니다.
둘 다, gcc 는 제대로 설치가 된 것 같은데요
뭐가 문제일까요?
감사합니다 (--)(__)
첨부 | 파일 크기 |
---|---|
![]() | 4.68 KB |
저두 초짜지만 혹시 이거 한번 해 보세요.
음.. /usr/include/c++/4.4/cstdlib
를 보니깐 abort, exit가 정의되어 있네요.
그래서.. 추가를 해 주니 일단 에러 없이 컴파일은 되네요. 자세한 사용법은 몰라서 걍 컴파일만 했습니다.
아래 문구 추가해야 할 파일 목록 : common.sphere.cpp, Sphere.cpp
꺽새가 특수문자라서인지 안보이네요.. 하여간 cstdlib 를 표준으로 포함하세요.
----------------------------------
#include < cstdlib >
댓글 달기