![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help:NFS mknod failed | steeles | SUN Solaris | 0 | 01-25-2008 08:05 AM |
| Failed to power up | fredginting | SUN Solaris | 2 | 01-07-2008 07:05 PM |
| Backup failed | nervous | UNIX for Dummies Questions & Answers | 10 | 01-02-2008 11:50 PM |
| Last Failed Login | gilberteu | SUN Solaris | 2 | 08-06-2007 07:32 PM |
| dlopen failed! | virmin | High Level Programming | 1 | 10-30-2005 08:19 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
g++ is OK while gcc is failed
[test.cpp]
#include <iostream> using namespace std; int main(void) { cout << "hello" << endl; return 0; } I tried this: 1) g++ test.cpp -o test // It's OK 2) gcc test.cpp -o test // Failed /tmp/ccriZviL.o(.text+0x14): In function `main': : undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)' /tmp/ccriZviL.o(.text+0x21): In function `main': : undefined reference to `std::cout' /tmp/ccriZviL.o(.text+0x26): In function `main': : undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std: /tmp/ccriZviL.o(.text+0x2f): In function `main': : undefined reference to `std::basic_ostream<char, std::char_traits<char> >: /tmp/ccriZviL.o(.text+0x5c): In function `__static_initialization_and_destruction_0(int, int)': : undefined reference to `std::ios_base::Init::Init[in-charge]()' /tmp/ccriZviL.o(.text+0x8b): In function `__tcf_0': : undefined reference to `std::ios_base::Init::~Init [in-charge]()' /tmp/ccriZviL.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0' collect2: ld returned 1 exit status In my case, I am only allowed to use gcc. How to use gcc to let the compilation & link pass? Any comiple/link arguments needed? Thanks. |
| Forum Sponsor | ||
|
|