Simple C++ code won't compile on 2 out of 3 systems
I need some help to sort out why only my old 30 Fedora 2 school boxes will compile:
#include <iostream> using namespace std; int main( ) { cout << "Hello World!!"; } While my two thin servers running Fedora 3 and 4 serving 100 clients fails to compile... with: [jim@adminmrc Programming]$ gcc -Wall -o dallasisspecial dallas.cpp /tmp/ccAdWbGa.o(.text+0xd): In function `std::__verify_grouping(char const*, unsigned int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': : undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::size() const' /tmp/ccAdWbGa.o(.text+0x60): In function `std::__verify_grouping(char const*, unsigned int, . . . : undefined reference to `std::cout' /tmp/ccAdWbGa.o(.text+0x126): In function `main': : undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)' /tmp/ccAdWbGa.o(.text+0x152): In function `__static_initialization_and_destruction_0(int, int)': : undefined reference to `std::ios_base::Init::Init()' /tmp/ccAdWbGa.o(.text+0x181): In function `__tcf_0': : undefined reference to `std::ios_base::Init::~Init()' /tmp/ccAdWbGa.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0' collect2: ld returned 1 exit status Thanks, Jim |
Use g++ to compile C++-programs, gcc is for C-programs.
|
Your main method expects an Integer as return value too. Don't forget to have a return 0; or something at the end.
|
Just in case you were wondering
g++ = gcc -lstdc++ |
Thanks!
Thanks!
OHH!!! Just too many thing going on I guess to think straight. |
All times are GMT -5. The time now is 10:20 AM. |