-
Errors - newb#2
<< split from http://cboard.cprogramming.com/cplus...5Bnewb%5D.html >>
I am a newb also just starting with C++. I am getting the same errors with Code Blocks. For some reason it is not recognizing iostream as a header file. I have only tried running the sample code in the tutorials which include iostream and have the same type of errors.
Thanks,
Ken
-
Know that Code::Blocks is an IDE and not a compiler.
If you're going to use it, make sure you've downloaded the Code::Blocks + mingw package. That way you should be set off to go directly.
-
I guess I should have been more clear. I am using the GCC compiler in Code Blocks. I have set up the linker with the paths to all the libraries that come with Code Blocks, but it still comes up with the error: No such file or directory. I just don't have enough experience with Code Blocks settings to figure it out.
Update: By the way, I am only trying to run the C++ code for "Hello world". I added the .h file extension to iostream and was able to get the code to compile, but when I run it I get a segmentation error. This is the result of the debugger:
Setting breakpoints
Debugger name and version: GNU gdb 6.8
Child process PID: 1940
Program received signal SIGSEGV, Segmentation fault.
In ntdll!RtlAddAccessDeniedObjectAce () (C:\Windows\system32\ntdll.dll)
Ken
-
Problem solved. I copied the iostream header file into my project and everything works now. My next question is: do these header files always have to be copied into your project or is the compiler supposed to find them automatically?
-
The compiler is supposed to find the standard headers automatically. It sounds like the compiler was not installed correctly.
-
I thought that it should. I have tried adding all of the paths to the included libraries that came with Code Blocks in the global linker settings and the paths to the include folders but it still comes up with the No such file or directory error. I will keep working to figure this out.
Thanks,
Ken
Update: I removed all the paths from the global linker settings and added: "C:\Program Files\CodeBlocks\MinGW\bin" to the global searh directories for the compiler and everything is fine now. You would think that that path would be added when the program installs but it doesn't. I'm just glad I can get the code in the tutorials to run now.
-
Just remember: don't use the headers ending with .h (ie iostream.h).
-
Yes, that was a mistake on my part being a newb. The code would compile, but when I run it it was causing the segmentation error. I have since removed the .h from the iostream file and everything is working fine now.
Thanks,
Ken