Skip to content

Instantly share code, notes, and snippets.

@ariscop
Created April 7, 2013 00:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ariscop/5328317 to your computer and use it in GitHub Desktop.
Save ariscop/5328317 to your computer and use it in GitHub Desktop.
[andrew@andrews-laptop tmp]$ cat test.cpp
#include <string>
using namespace std;
int main(int argc, char *argv[]) {
string *str = new string("test");
}
[andrew@andrews-laptop tmp]$ g++ -nostdlib test.cpp
/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000000400144
/tmp/ccueTy8M.o: In function `main':
test.cpp:(.text+0x1a): undefined reference to `std::allocator<char>::allocator()'
test.cpp:(.text+0x28): undefined reference to `operator new(unsigned long)'
test.cpp:(.text+0x3b): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
test.cpp:(.text+0x4b): undefined reference to `std::allocator<char>::~allocator()'
test.cpp:(.text+0x5d): undefined reference to `operator delete(void*)'
test.cpp:(.text+0x71): undefined reference to `std::allocator<char>::~allocator()'
test.cpp:(.text+0x7c): undefined reference to `_Unwind_Resume'
/tmp/ccueTy8M.o:(.eh_frame+0x13): undefined reference to `__gxx_personality_v0'
collect2: error: ld returned 1 exit status
[andrew@andrews-laptop tmp]$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment