윈도우 Vista에서 MinGW gcc실행 에러

0
points

윈도우 비스타에서 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

와 같이 됩니다. 이게 왜 이러는지를 잘 몰라서.... 조언 좀 부탁드립니다.

kewlbear의 이미지
1160
points

-lstdc++ 해줘야 하지

1
point

-lstdc++ 해줘야 하지 않을까요?

monpetit의 이미지
7792
points

C++ 컴파일러를 사용하세요.

1
point

C:\MinGW\bin>gcc ex.cpp

대신

C:\MinGW\bin>g++ ex.cpp

이렇게요...

-----
익명으로 쓴 글은 볼 수 없습니다.
http://monpetit.tistory.com/

댓글 보기 옵션

원하시는 댓글 전시 방법을 선택한 다음 "설정 저장"을 누르셔서 적용하십시오.