Surat Linux Users Group Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
Need help to compile the file in C++ in linux

 
Reply to topic    Surat Linux Users Group Forum Index » Help and Support View previous topic
View next topic
Need help to compile the file in C++ in linux
Author Message
THE_ONE
Linux Bees
Linux Bees


Joined: 25 Mar 2008
Posts: 26
Location: India

Post Need help to compile the file in C++ in linux Reply with quote
Hello all,

i am learning C++ on linux.
i have tried to compile very simple code "Fiert.cc"

Code:
1: #include <iostream.h>
2:
3: main()
4: {
5:     float pi = 3.14;
6:     cout << "The value of pi is " << pi << "\n";
7:     return 0;

8: }

when i compiled this code i am getting such warning msg.

Quote:
In file included from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/backward/iostream.h:31,
from 1.cpp:1:
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
/tmp/ccYMN8qn.o: In function `__static_initialization_and_destruction_0(int, int)':
1.cpp:(.text+0x23): undefined reference to `std::ios_base::Init::Init()'
/tmp/ccYMN8qn.o: In function `__tcf_0':
1.cpp:(.text+0x6c): undefined reference to `std::ios_base::Init::~Init()'
/tmp/ccYMN8qn.o: In function `main':
1.cpp:(.text+0x96): undefined reference to `std::cout'
1.cpp:(.text+0x9b): 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*)'
1.cpp:(.text+0xac): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(float)'
1.cpp:(.text+0xbc): 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/ccYMN8qn.o: (.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status


can any one please help me to solve this problem..??

_________________
with regards,

Hitesh D R
Mon May 05, 2008 10:31 am View user's profile Send private message Send e-mail Yahoo Messenger
rohan
Site Admin
Site Admin


Joined: 14 Mar 2008
Posts: 45
Location: India

Post Reply with quote
try to check this out http://www.yolinux.com/TUTORIALS/LinuxTutorialC++StringClass.html

_________________
With Regards,
Rohan Bhagat
==============
Surat Linux Users Group
http://www.suratlug.org
==============
"With Great Powers, Comes the Great Responsibility"
Mon May 05, 2008 2:19 pm View user's profile Send private message Visit poster's website
THE_ONE
Linux Bees
Linux Bees


Joined: 25 Mar 2008
Posts: 26
Location: India

Post Reply with quote
thank you so much rohan,

i have got the solution for that warnings.
BTW, i was able to see output in my last code also but the problem was warning.
it was appearing on every compilation.
any way thanks again.

i am uploading my updated code here. so other user like me can get idea from it.

Code:
#include <iostream>
main()
{
float pi = 3.14;
std::cout << "The value of pi is " << pi << "\n";
return 0;
}


_________________
with regards,

Hitesh D R
Tue May 06, 2008 2:54 am View user's profile Send private message Send e-mail Yahoo Messenger
rohan
Site Admin
Site Admin


Joined: 14 Mar 2008
Posts: 45
Location: India

Post Reply with quote
well thnx for reply,
m happy that it helped u.
have a good day

_________________
With Regards,
Rohan Bhagat
==============
Surat Linux Users Group
http://www.suratlug.org
==============
"With Great Powers, Comes the Great Responsibility"
Tue May 06, 2008 7:56 am View user's profile Send private message Visit poster's website
Display posts from previous:    
Reply to topic    Surat Linux Users Group Forum Index » Help and Support All times are GMT
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.