Thread: I need help with my compiler

  1. #1
    Registered User
    Join Date
    Oct 2003
    Posts
    7

    I need help with my compiler

    I just got the Dev-C++ and I am tyring to make a simple program, but when I put in the code and I compile it, it always says, "unable to run program"

    Here's the code:

    Code:
    #include <iostream.h> 
    int main() 
    {
      cout<<"HEY, you, I'm alive!  Oh, and Hello World!"; 
      return 0;    
    }
    CAN ANYONE HELP ME OUT!?!

  2. #2
    Registered User
    Join Date
    Mar 2002
    Posts
    1,595
    try using the up to date headers and namespaces.

    #include <iostream>
    using namespace std;

    if that doesn't work then there is something wrong with the installation or one of the project/environment/options settings is off.

  3. #3
    still a n00b Jaguar's Avatar
    Join Date
    Jun 2002
    Posts
    187
    Once I found this problem, I fix it by installing Dev-C++ at C:\ don't go to other drives or any sub-directories. It could also fix your problem.
    Try it and let me know.
    slackware 10.0; kernel 2.6.7
    gcc 3.4.0; glibc 2.3.2; vim editor
    migrating to freebsd 5.4

  4. #4
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    Yeah, it looks like a configuration problem...

    I don't use Dev-C++, but the error says that the compiler is not running, so I suspect you're right, you are having a compiler problem. I don't think it has anything to do with your code. You're trying to run the compiler to compile (process) your source file.

    I've used a handful of different compilers, and I don't think any of them ever worked on the first try... so don't give-up yet... Dev-C++ is very popular, so you know it can work!

    All I can suggest is that you carefully read all to installation / configuration documentation files. Maybe the compiler isn't installed in the usual default location and the IDE can't find it???
    Maybe something in this tutorial will help ???

  5. #5
    Registered User
    Join Date
    Oct 2003
    Posts
    7
    hey elad, when you said

    >#include <iostream>
    using namespace std;

    what do you mean? im not that good with c++and wen i put my code, i had just copied so i dont know what you're saying. please help

  6. #6
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    Briefly, the dot-h header files are "depreciated". This means that they are outdated, but still supported for compatablity. Your program should still compile with the .h syntax, but you might have to set a compiler option.

    You can find some explanation of using namespace std in the programming FAQ, and you should find lots of discussion if you search the board for "namespace".
    Last edited by DougDbug; 10-24-2003 at 06:32 PM.

  7. #7
    Registered User
    Join Date
    Sep 2003
    Posts
    135
    Originally posted by DougDbug
    Briefly, the dot-h header files are "depreciated". This means that they are outdated, but still supported for compatablity. Your program should still compile with the .h syntax, but you might have to set a compiler option.
    I think you mean deprecated rather than depreciated. Note that <iostream.h> is not a deprecated header, it's simply non-standard. It existed before the C++ standard, was used in (probably) millions of C++ programs, and is retained by many compilers for reasons of backwards compatibility. A conforming C++ compiler isn't required to provide it, and you can't rely on one compiler's <iostream.h> exactly matching that on another compiler.

    Header files that are deprecated are the older C library headers, e.g. <time.h>, <stdio.h> etc. They are included in the C++ standard, so you can rely on your C++ compiler providing them, and rely on them providing the contents required by the standard. However, by making use of them deprecated the standard is saying that support for them is not guaranteed in future revisions of the standard. That's why new development should be written using the versions introduced by the C++ library, e.g. <ctime> and <cstdio>.

  8. #8
    still a n00b Jaguar's Avatar
    Join Date
    Jun 2002
    Posts
    187
    TheRealNapster

    Dev-C++ supports backward compatability it should be fine whether you put ``.h'' or not.
    I think you have installation problem.
    Try one as I suggested. Install it in root of C:\ don't go anywhere or any sub-directory.
    slackware 10.0; kernel 2.6.7
    gcc 3.4.0; glibc 2.3.2; vim editor
    migrating to freebsd 5.4

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiler Paths...
    By Cobra in forum C++ Programming
    Replies: 5
    Last Post: 09-26-2006, 04:04 AM
  2. C Compiler and stuff
    By pal1ndr0me in forum C Programming
    Replies: 10
    Last Post: 07-21-2006, 11:07 AM
  3. I can't get this new compiler to work.
    By Loduwijk in forum C++ Programming
    Replies: 7
    Last Post: 03-29-2006, 06:42 AM
  4. how to call a compiler?
    By castlelight in forum C Programming
    Replies: 3
    Last Post: 11-22-2005, 11:28 AM
  5. Bad code or bad compiler?
    By musayume in forum C Programming
    Replies: 3
    Last Post: 10-22-2001, 09:08 PM