GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 03-Mar-2005, 19:05
batrsau batrsau is offline
New Member
 
Join Date: Mar 2005
Posts: 15
batrsau is on a distinguished road

Newbie : need help with Dev-C++ compiler


Hi !

I am newbie trying to learn to code in C and I recently installed the Dev-C++ compiler I had a few questions about the compiler :

I tried to use some C++ syntax and the compiler gave me an error, in the documentation i read that the MiniGW which is the compiler system used gcc for C compiling and g++ for C++ compiling

The code is listed as follows :

CPP / C++ / C Code:
#include<iostream>

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

The error I received was this :

Quote:
C:\Documents and Settings\Saurav Batra\My Documents\Code\TestCode\test.cpp In function `int main()':
5 C:\Documents and Settings\Saurav Batra\My Documents\Code\TestCode\test.cpp `cout' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it appears in.)


Here are the questions that popped up :

"Does the dev-C++ compiler compile only C code , if not how can I make it do only that if possible ????? "

Iam looking for a C compiler that compiles on C code and not C++,

I was using visual C++ before to compile before, the problem with VC++ is that it allows you to mix C and C++ code and doesn't complain about.

It is also my fault to a great extent since I am trying to correct my programming style by being able to write code which is specific to C or C++ so any help with a C compiler would be appreciated. I am running windows XP
Last edited by LuciWiz : 04-Mar-2005 at 00:13. Reason: Plese insert your C++ code between [c++] & [/c++] tags
  #2  
Old 04-Mar-2005, 09:49
Dr. Evil Dr. Evil is offline
Member
 
Join Date: Oct 2004
Location: Netherlands
Posts: 120
Dr. Evil will become famous soon enough
I'm not an expert at C++, but I think if you include iostream without the .h extension, you have to use std::cout or declare 'using namespace std' before you use any i/o operators.
  #3  
Old 20-Mar-2005, 21:05
ubergeek ubergeek is offline
Regular Member
 
Join Date: Jan 2005
Posts: 775
ubergeek is a jewel in the roughubergeek is a jewel in the roughubergeek is a jewel in the rough
Dr. Evil is right. cout and cin and endl and everything in the standard headers is defined within the std namespace, so you have to include "usng namespace std;" (no quotes) to use them. alternatively, access them by std::cout etc.
 
 

Recent GIDBlogProblems with the Navy (Officers) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
help with borland compiler Mjkramer21 C++ Forum 2 08-Jul-2005 19:53
32 bit compiler needed meet_raman C++ Forum 2 24-Jun-2004 03:42
newbie using Sam's series Skampy C++ Forum 3 06-Mar-2004 18:51
a noobish compiler question Charunks C++ Forum 5 03-Sep-2003 02:18
i need a free Mac compiler yerdos C++ Forum 1 28-Jul-2003 02:12

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 22:33.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.