Dev C Cout Does Not Name A Type

  

  1. Dev C Cout Does Not Name A Typeype
  2. Dev C Cout Does Not Name A Type
  3. Dev C Cout Does Not Name A Type One
  4. Dev C Cout Does Not Name A Type 2
Home » Language IDEs » C / C++ IDE (CDT) »

Dev C Cout Does Not Name A Typeype

NameSymbol 'cout' could not be resolved

The Mingw32 Alternate C Runtime Library is being developed as a replacement for the Microsoft C Runtime Library (MSVCRT.DLL) because there is a need for a C Runtime Library for Mingw32 users which is not dependent on the Microsoft C Runtime Library, open-source, not licensed under the GPL or LGPL, and can be used freely for commercial use. Allegro.cc Forums » Programming Questions » 'does not name a type' error, general c question Credits go to James Stanley and Milan Mimica for helping out! This thread is locked; no one can reply to it.

Show:Today's Messages::Show Polls::Message Navigator
Symbol 'cout' could not be resolved[message #1080966]Tue, 06 August 2013 16:12
Eclipse User
Hello,
I'm starting with Eclipse, but I cannot seem to be able to compile a
simple C++ Hello World program. On build, I have 2 errors:
Symbol 'cout' could not be resolved
Symbol 'endl' could not be resolved
I'm running:
* IDE: Eclipse-CDT, Version: Kepler Release, Build id: 20130614-0229 32-
bits
* JAVA: JRE 32-bits 1.7.0_25-b17
* Toolchain: MinGw: mingw-get-inst-20120426.exe with compilers for C, C+
+, and MSYS Basic System
* OS: Windows 7 Professional 64-bits
The program:
START
#include <iostream>
using namespace std;
int main() {
std::cout << '!!!Hello World!!!' << std::endl; // prints !!!Hello
World!!!
return 0;
}
END
I'm using toolchain MinGW GCC, with CDT Internal Builder. Environment
variables are:
MINGW_HOME = C:MinGW
MSYS_HOME = C:MinGWmsys1.0
PATH = ${MINGW_HOME}bin;${MSYS_HOME}bin;C:/Program Files (x86)/Java/jre7/
bin/client;C:/Program Files (x86)/Java/jre7/bin;C:/Program Files (x86)/
Java/jre7/lib/i386;;C:Program Files (x86)GTK2-Runtimebin;C:eclipse;
(etc)
Om C/C++ Build > Settings > Tool Settings > GCC C++ Compiler > Includes I
have added C:MinGWlibgccmingw324.6.2includec++
Everything else is set to defaults.
When I save and build the project, I get
09:32:32 **** Incremental Build of configuration Debug for project
Eclipse-002 ****
Info: Internal Builder is used for build
g++ -O0 -g3 -Wall -c -fmessage-length=0 -o 'srcEclipse-002.o' '..src
Eclipse-002.cpp'
09:32:32 Build Finished (took 90ms)
Unresolved Inclusions shows <iostream>, even though it's located at C:
MinGWlibgccmingw324.6.2includec++ and it's part of the GCC C++
includes.
I've been googling for a couple of days with no luck. I've removed
Eclipse, installed it from scratch. I had Cygwin installed besides MinGw
and I removed it. I've tried with 'std::cout' and without 'std::' .
I'm sure I'm overlooking something simple :/
Thank you in advance.
--
Sinner
Re: Symbol 'cout' could not be resolved[message #1081502 is a reply to message #1080966]Wed, 07 August 2013 09:53
Axel Mueller
Messages: 1973
Registered: July 2009
That is *not* a compiler error. It is an error from the static code analyzer. In the Problems View you can distinguish between compiler and code analyzer errors via the column problem type. In the editor there are different icons.
But back to your problem. In your case it is a false warning. The code analyzer (CODAN) does not recognize the symbol 'cout' because it does not find the system includes (iostream). Eclipse usually automatically finds the correct system includes (so need for you to add them in C/C++ Build > Settings > Tool Settings > GCC C++ Compiler > Includes ). However, to find these includes Eclipse needs to know where MinGW is installed. You correctly configured environment variables for MinGW. But there is a bug with respect to the scanner discovery in Eclipse (the part that looks for the system includes etc.). It seems to ignore your PATH settings. I would suggest that you modify the PATH variable in Windows directly and then start Eclipse. Then you should rebuild the index (Project->Index->rebuild).

Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Symbol 'cout' could not be resolved[message #1081813 is a reply to message #1081502]Wed, 07 August 2013 18:25
Eclipse User
On Wed, 07 Aug 2013 11:53:18 +0200, Axel Mueller wrote:
> That is *not* a compiler error. It is an error from the static code
> analyzer. In the Problems View you can distinguish between compiler and
> code analyzer errors via the column problem type. In the editor there
> are different icons.
> But back to your problem. In your case it is a false warning. The code
> analyzer (CODAN) does not recognize the symbol 'cout' because it does
> not find the system includes (iostream). Eclipse usually automatically
> finds the correct system includes (so need for you to add them in C/C++
> Build > Settings > Tool Settings > GCC C++ Compiler > Includes ).
> However, to find these includes Eclipse needs to know where MinGW is
> installed. You correctly configured environment variables for MinGW. But
> there is a bug with respect to the scanner discovery in Eclipse (the
> part that looks for the system includes etc.). It seems to ignore your
> PATH settings. I would suggest that you modify the PATH variable in
> Windows directly and then start Eclipse. Then you should rebuild the
> index (Project->Index->rebuild).
Axel,
Thank you for your message.
You were correct: not a compiler problem, it was a PATH problem with MinGW.
In the end I had to remove MinGW and install it from scratch, as the very
slow pipe to the Internet messed up the installation several times.
Now, with a complete (so far!) install of MinGW I can compile and run
projects from Eclipse.
Thank you again.
--
Salut,
Sinner
Previous Topic:Syntax Highlighting Oddities
Next Topic:linking with depending libraries
Goto Forum:

Dev C Cout Does Not Name A Type


[ Syndicate this forum (XML) ] [ ]

Dev C Cout Does Not Name A Type One


Dev C Cout Does Not Name A Type 2

Powered by FUDForum. Page generated in 0.01941 seconds
Name
It's always hard for to follow this kind of error without having the code in front of me, but I think there actually is a possible dependency issue here.
There error is happening in Chromosome.h... based on the code you're giving, let's assume it's not compiling individual.cc correctly.
When we first go to compile individual.cc, first we #include Individual.h.
But... I can see from this line
Chromosome* Individual::getChromosome(){ return chromosome; }
That you need Individual to know what a Chromosome is (my guess is that an Individual has-a Chromosome)! So I assume you're trying to #include Chromosome.h within Individual.h. So you have a circular dependency.
I suggest exploring this dependency to see it yourself. One (possible) solution that I can't test is: Because the definition for Chromosome only relies on pointers to Individual, you don't need to #include Individual.h inside Chromosome.h.
Just declare it as being a class class Individual; instead, where you used to #include it in the header.