Errors - newb#2

This is a discussion on Errors - newb#2 within the C++ Programming forums, part of the General Programming Boards category; << 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 ...

  1. #1
    Registered User
    Join Date
    Jun 2010
    Posts
    5

    Errors - newb#2

    << split from Errors, please help [Newb] >>

    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

  2. #2
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,598
    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.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Registered User
    Join Date
    Jun 2010
    Posts
    5
    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
    Last edited by kw5368; 06-27-2010 at 05:44 AM.

  4. #4
    Registered User
    Join Date
    Jun 2010
    Posts
    5
    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?

  5. #5
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,717
    The compiler is supposed to find the standard headers automatically. It sounds like the compiler was not installed correctly.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #6
    Registered User
    Join Date
    Jun 2010
    Posts
    5
    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.
    Last edited by kw5368; 06-27-2010 at 06:56 AM.

  7. #7
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,598
    Just remember: don't use the headers ending with .h (ie iostream.h).
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  8. #8
    Registered User
    Join Date
    Jun 2010
    Posts
    5
    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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. global namespace errors
    By stubaan in forum C++ Programming
    Replies: 9
    Last Post: 04-02-2008, 03:11 PM
  2. Ten Errors
    By AverageSoftware in forum Contests Board
    Replies: 0
    Last Post: 07-20-2007, 10:50 AM
  3. Winsock compilation errors
    By jmd15 in forum Networking/Device Communication
    Replies: 2
    Last Post: 08-03-2005, 08:00 AM
  4. Unknown Errors in simple program
    By neandrake in forum C++ Programming
    Replies: 16
    Last Post: 04-06-2004, 02:57 PM
  5. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 04:44 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21