User forums > Help

How to make headers work?

(1/1)

Adestro:
I installed the codeblocks-8.02mingw-setup and created a project and fired up a hello world application. But the compiler can't find the core c++ headers.


--- Code: ---#include <iostream>
using namespace std;

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

--- End code ---

-------------- Build: Debug in Test ---------------

Compiling: main.c
F:\...\Test\main.c:3:20: iostream: No such file or directory
F:\...\Test\main.c:4: error: syntax error before "namespace"
F:\...\Test\main.c:4: warning: type defaults to `int' in declaration of `std'
F:\...\Test\main.c:4: warning: data definition has no type or storage class
F:\...\Test\main.c: In function `main':
F:\...\Test\main.c:8: error: `cout' undeclared (first use in this function)
F:\...\Test\main.c:8: error: (Each undeclared identifier is reported only once
F:\...\Test\main.c:8: error: for each function it appears in.)
Process terminated with status 1 (0 minutes, 0 seconds)
5 errors, 2 warnings

Please help me!

stahta01:
Try using an filename of main.cpp instead of main.c.
C::B thinks that if the file ends with .c you are doing C programming.

Tim S

Adestro:
Thanks a lot! Worked! :)

JGM:

--- Quote from: stahta01 on May 08, 2008, 02:01:15 pm ---C::B thinks that if the file ends with .c you are doing C programming.

--- End quote ---

I thought gcc was the one thinking that of *.c files.

Navigation

[0] Message Index

Go to full version