Undefined symbols for architecture x86_64: Which architecture should I use?

后端 未结 3 1475
难免孤独
难免孤独 2020-12-05 09:07

I\'m trying to do some really simple stuff in C++, but I can\'t find any information on how to tackle this. Even the book I have just says \"Just compile and run the program

相关标签:
3条回答
  • 2020-12-05 10:07

    The error isn't that it's the wrong architecture, it's that std::cout (and other symbols) isn't defined.

    You should compile and link with g++ not gcc, to automatically link with correct C++ libraries.

    0 讨论(0)
  • 2020-12-05 10:07

    The error is caused because you're compiling with gcc, which only default-links libc. You need to compile with g++ so that libstdc++ is auto-linked in too.

    0 讨论(0)
  • 2020-12-05 10:13

    Use g++ instead of gcc to link with exact c++ libraries

    0 讨论(0)
提交回复
热议问题