Dev C%2b%2b Cout Does Not Name A Type

Home » Language IDEs » C / C++ IDE (CDT) » Symbol 'cout' could not be resolved

Dev C Does Not Name A Type B Point.h is as follows: 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! The first problem is that extern is only valid before the name of a type, so that's what the compiler is complaining about. The second is that cout is defined in the namespace std, so you need to tell the compiler to look there. The good thing is that the code doesn't say using namespace std.

Dev C 2b 2b Cout Does Not Name A Type 3

Show:Today's Messages::Show Polls::Message Navigator
Dev
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

Dev C 2b 2b Cout Does Not Name A Type B

Dev
Previous Topic:Syntax Highlighting Oddities
Next Topic:linking with depending libraries
TypeGoto Forum:
[ Syndicate this forum (XML) ] [ ]

Dev C 2b 2b Cout Does Not Name A Type 2

DoesName

Dev C 2b 2b Cout Does Not Name A Type 1

Powered by FUDForum. Page generated in 0.02594 seconds