Author Topic: 1st time compile CodeBlocks  (Read 5045 times)

Offline R_W_B

  • Single posting newcomer
  • *
  • Posts: 2
1st time compile CodeBlocks
« on: May 12, 2016, 03:15:21 pm »
I"ve been using Dev C's IDE for awhile, it worked right out of the box, but decided to try CodeBlocks. I downloaded and installed the codeblocks-16.01mingw-setup.exe.  Everything seemed to install fine, when I looked it seems to use the same compiler as Dev C does (gcc.exe).  Ok here's my problem I paste in a small quick little file that I've compiled with no issues on Dev C and try it. I get the following error something bout cannot find iostream header file.  Does the install not configure installed include path ? What should I first investigate at this point?
Code snippet and compiler log below,

#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
// other non pertinent code
-------------- Build file: "no target" in "no project" (compiler: unknown)---------------

mingw32-gcc.exe -g  -c "Z:\PROGRAMMING\1_CodeBlocks Projects\Main.c" -o "Z:\PROGRAMMING\1_CodeBlocks Projects\Main.o"
Z:\PROGRAMMING\1_CodeBlocks Projects\Main.c:3:20: fatal error: iostream: No such file or directory
 #include <iostream>
                    ^
compilation terminated.
Process terminated with status 1 (0 minute(s), 2 second(s))
1 error(s), 0 warning(s) (0 minute(s), 2 second(s))
------------------end error log----------
The file is in, C:\Program Files (x86)\CodeBlocks\MinGW\lib\gcc\mingw32\4.9.2\include\c++\
But not in, C:\Program Files (x86)\CodeBlocks\MinGW\include\
Should I put "both" of them in the search directories ??

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: 1st time compile CodeBlocks
« Reply #1 on: May 12, 2016, 09:29:24 pm »
Rename it to Main.cpp, so the correct (C++-)compiler is used, otherwise the C-compiler is used and it does not know "iostream"

Offline R_W_B

  • Single posting newcomer
  • *
  • Posts: 2
Re: 1st time compile CodeBlocks
« Reply #2 on: May 13, 2016, 01:26:18 am »
Oh thanks, it's an old file I should have noticed that, however it did compile in Dev C.
I will keep experimenting with the path setups etc.