Re: Error when compiling with g++ in Fedora Core 7

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





----- Original Message ----

From: Aquil H. Abdullah <aquil.abdullah@xxxxxxxxx>

To: fedora-list@xxxxxxxxxx

Sent: Friday, June 15, 2007 9:14:50 PM

Subject: Error when compiling with g++ in Fedora Core 7



Hello All,

  I have just installed Fedora Core 7 on an x86 system.  It was the smoothest install of any Fedora Core that I have attempted.  However, I am having a problem using the gnu compiler in particular with g++.  I have written a simple hello world program: 



#include <iostream>



int main(void)

{

  std::cout <<"Hello, World!" << std::endl;

  return 0;

}



and attempted to compile it using the command:



[aha@boombata  devel]$ g++ -o hello hello.cc 

hello.cc:1:20: error: iostream: No such file or directory

hello.cc: In function 'int main()':

hello.cc:5: error: 'cout' is not a member of 'std'

hello.cc:5: error: 'endl' is not a member of 'std' 



As you can see for some reason iostream.h is not being found, even though I have confirmed it's existence:



[aha@boombata backward]$ ls /usr/include/c++/4.1.2/backward/iostream.h 

/usr/include/c++/4.1.2/backward/iostream.h 



Now I may be in the wrong place for such a question, but does anyone have any about how to fix this problem. I am embarrassed to call myself a developer :(



Regards



-- 

Aquil H. Abdullah 

aquil.abdullah@xxxxxxxxx -- 

fedora-list mailing list

fedora-list@xxxxxxxxxx

To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list









Aquil,

You are missing something.  I tried your simple hello program using both c++ and g++ and it worked for me.

[olivares@localhost Documents]$ c++ -o hello hello.cpp
[olivares@localhost Documents]$ ./hello 
Hello, World!
[olivares@localhost Documents]$ g++ -o hello2 hello2.c 
[olivares@localhost Documents]$ ./hello2
Hello, World!
[olivares@localhost Documents]$ cat hello.cpp 
#include <iostream>

int main(void)
{
  std::cout <<"Hello, World!" << std::endl;
  return 0;
}
[olivares@localhost Documents]$ cat hello2.c
#include <iostream>

int main(void)
{
  std::cout <<"Hello, World!" << std::endl;
  return 0;
}
[olivares@localhost Documents]$ 

Save the file as hello.c only or *.cpp and try it again.

Regards,

Antonio 




       
____________________________________________________________________________________
Need a vacation? Get great deals
to amazing places on Yahoo! Travel.
http://travel.yahoo.com/


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux