std 사용하는데 왜 에러가 나는지 모르겠습니다 ㅠㅠ

lacovnk의 이미지

#include <string>
using namespace std;

string::size_type myRecvUntilGet(int,string&,const char*);

string::size_type
myRecvUntilGet(int socket,string& buf,const char* target)
{blabla..}

main도 blabla..

그런데, iostream을 include해주면 다음과 같이 에러가;

Quote:
/tmp/cc26nIn7.o(.text+0x49): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `std::ios_base::Init::Init[in-charge]()'
/tmp/cc26nIn7.o(.text+0x7a): In function `__tcf_0':
: undefined reference to `std::ios_base::Init::~Init [in-charge]()'
/tmp/cc26nIn7.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status

제가 무슨짓을 한거죠?;;;

fromdj의 이미지

gcc a.cpp -lstdc++

standard c++ 라이브러리를 링크해 줘야 겠죠
이런식의 guessing 은 /lib 폴더에 있는 파일들을 통해서
해볼수 있습니다.

^^ be cool ~
http://fromdj.pe.kr

cinsk의 이미지

frontend g++ 또는 c++을 쓰기 바랍니다.

lacovnk의 이미지

makefile로 안돌리고 직접 테스트한다는게 -_-

g++아닌 gcc로 했습니다 -_-;; :oops:

7339989b62a014c4ce6e31b3540bc7b5f06455024f22753f6235c935e8e5의 이미지