윈도우 Vista에서 MinGW gcc실행 에러
윈도우 비스타에서 MingGW를 깔고 써보려고 하는 초짜입니다.
MingGW를 다 깔고 시험삼아
#include
int main()
{
std::cout << "Welcome to C++!\n";
return 0:
}
를 컴파일 시켰는데,
C:\MinGW\bin>gcc ex.cpp
ex.cpp:6:2: warning: no newline at end of file
C:\Users\MUWIZA~1\AppData\Local\Temp/ccTzpjrq.o:ex.cpp:(.text+0xd): undefined re
ference to `std::string::size() const'
C:\Users\MUWIZA~1\AppData\Local\Temp/ccTzpjrq.o:ex.cpp:(.text+0x60): undefined r
eference to `std::string::operator[](unsigned int) const'
C:\Users\MUWIZA~1\AppData\Local\Temp/ccTzpjrq.o:ex.cpp:(.text+0x9e): undefined r
eference to `std::string::operator[](unsigned int) const'
C:\Users\MUWIZA~1\AppData\Local\Temp/ccTzpjrq.o:ex.cpp:(.text+0xcc): undefined r
eference to `std::string::operator[](unsigned int) const'
C:\Users\MUWIZA~1\AppData\Local\Temp/ccTzpjrq.o:ex.cpp:(.text+0x133): undefined
reference to `std::cout'
C:\Users\MUWIZA~1\AppData\Local\Temp/ccTzpjrq.o:ex.cpp:(.text+0x138): undefined
reference to `std::basic_ostream >& std::operator<<
>(std::basic_ostream >&, c
har const*)'
C:\Users\MUWIZA~1\AppData\Local\Temp/ccTzpjrq.o:ex.cpp:(.text+0x161): undefined
reference to `std::ios_base::Init::Init()'
C:\Users\MUWIZA~1\AppData\Local\Temp/ccTzpjrq.o:ex.cpp:(.text+0x17c): undefined
reference to `std::ios_base::Init::~Init()'
collect2: ld returned 1 exit status
와 같이 됩니다. 이게 왜 이러는지를 잘 몰라서.... 조언 좀 부탁드립니다.
-lstdc++ 해줘야 하지
-lstdc++ 해줘야 하지 않을까요?
C++ 컴파일러를 사용하세요.
C:\MinGW\bin>gcc ex.cpp
대신
C:\MinGW\bin>g++ ex.cpp
이렇게요...
-----
익명으로 쓴 글은 볼 수 없습니다.
http://monpetit.tistory.com/
-----
http://monpetit.posterous.com/
http://monpetit.tistory.com/
댓글 달기