0
#include<iostream>
using namespace std;
class welcome{
public:
	welcome(){
		cout<<"Constructor";
	}
};
int main(){
	welcome c;
	return 0;
}

for the above code i get the following errors wen i try to compile using GCC in PCLinux minime version.
cannot figure out if there is an error in my program or in the gcc installation. i used synaptic to install gcc.

if this is not the appropriate place to post this message, kindly redirect me.

[joe@localhost apps]$ gcc welcome.cc
/home/joe/tmp/ccbhvMO0.o: In function `__static_initialization_and_destruction_0(int, int)':
welcome.cc: (.text+0x23): undefined reference to `std::ios_base::Init::Init()'
/home/joe/tmp/ccbhvMO0.o: In function `__tcf_0':
welcome.cc: (.text+0x6c): undefined reference to `std::ios_base::Init::~Init()'
/home/joe/tmp/ccbhvMO0.o: In function `welcome::welcome()':
welcome.cc: (.text._ZN7welcomeC1Ev[welcome::welcome()]+0x11): undefined reference to `std::cout'
welcome.cc: (.text._ZN7welcomeC1Ev[welcome::welcome()]+0x16): 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*)'
/home/joe/tmp/ccbhvMO0.o: (.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
[joe@localhost apps]$

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by rje7
0

You need to compile C++ programs in GCC using g++ and not gcc.

g++ filename

:) thank you,..

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.