C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old December 29th, 2002, 12:29 PM
poring poring is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Posts: 68 poring User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 39 m 9 sec
Reputation Power: 7
compiling a simple script in linux

I just installed RedHat 8.0 on my computer, and when I try to compile a simple c++ program, I get a strange warning about the header include. See:
http://users.pandora.be/fourtyseven/cplus.jpg

If I remove the '.h' part in the include, I don't get this warning anymore, but then of course it says that 'cout' is undeclared.

Could anyone help? Thanks.

Last edited by poring : December 29th, 2002 at 01:39 PM.

Reply With Quote
  #2  
Old December 29th, 2002, 05:34 PM
dcaillouet's Avatar
dcaillouet dcaillouet is offline
Big Endian
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: May 2001
Location: Fly-over country
Posts: 1,173 dcaillouet User rank is Sergeant (500 - 2000 Reputation Level)dcaillouet User rank is Sergeant (500 - 2000 Reputation Level)dcaillouet User rank is Sergeant (500 - 2000 Reputation Level)dcaillouet User rank is Sergeant (500 - 2000 Reputation Level)dcaillouet User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 16 h 29 m 5 sec
Reputation Power: 24
I could not replicate your problem on my SuSE box. On my box, the program includes the /usr/include/g++/iostream.h file. Your error message says that its including the /usr/include/c++/backward/iostream.h file. The word backward in the path indicates to me that this may be an older file that is included for backward compatability. My guess is that you're using the "wrong" iostream.h file and need to adjust some settings on your machine so your compiles look at a different include directory.

Also, if you want to leave the .h off your include files, you might want to look at the following post:

http://forums.devshed.com/showthread.php?threadid=45679

Reply With Quote
  #3  
Old December 30th, 2002, 09:12 AM
ClayDowling ClayDowling is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Flint, MI
Posts: 328 ClayDowling User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 19 m 25 sec
Reputation Power: 6
First, compiling from within emacs can be problematic. I generally prefer to work from a command line.

Second, try the following code to accomplish the same goals:

Code:
#include <iostream>

using namespace std;

int main() {
  cout << "Hello" << endl;
  return 0;
}


The STL libraries do not use the .h extension, although typically there is a link to the file with a .h extension roaming around on the hard drive. Everything in the STL libraries is within the std namespace, so having that in place will help.
__________________
Clay Dowling
Lazarus Notes
Articles and commentary on web development
http://www.lazarusid.com/notes/

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > compiling a simple file in linux


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway