Thread: Help with the Dev-C++ compiler

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    14

    Help with the Dev-C++ compiler

    heres the top of my code:


    #include <iostream.h>
    #include <string.h>
    #include <ctype.h>
    #include <iomanip.h>


    when i try and compile, it says "#include expects 'FILENAME' or <FILENAME>"


    whats wrong? is there something i have to do for this compiler to work?

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    There doesn't appear to be anything wrong. Although the new c++ standard calls for you to use #include <iostream> over what you did. If you are using mingw 3.2 (that doesn't come with dev-c++) then you could turn on the decrpecation options. Other than that my only other guess is that what you posted here isn't the same as your code.

    Occasionally, I accidentaly write code like this:

    Code:
    #include <cstring"
    Did you so something like that? If so then you did get the appropriate error.

  3. #3
    thats weird i use dev C++ i have never had that error but master is right the 'new way' of writing includes is

    Code:
    #include <iostream>
    //etc
    Dev C++
    Win XP/2k/98

    I DO NOT TAKE CLASSES I DONT GET HOMEWORK THIS IS NOT A HOMEWORK QUESTION!!!

    He's lean he's keen... He's the spank machine!

  4. #4
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Could you post your entire c file? Something else is wrong. Unless you modified one of these files then your code should compile. I think Dev-C++ uses 2.95 which doesn't even comment on the new standard as far as includes go, and even then your error would be:

    C:\COMP\MINGW\include\c++\3.2\backward\backward_wa rning.h:32
    #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated.
    So I'm sure something else is wrong.

  5. #5
    Registered User
    Join Date
    Nov 2002
    Posts
    14
    even when i do a simple program like:

    #include <iostream.h>

    int main ()
    {

    cout<<"hello"<<endl;

    return 0;
    }



    the run screen just flashes up and goes away in a matter of 1/10th of a second. this compiler has major issues.

  6. #6
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    Originally posted by ray
    even when i do a simple program like:

    #include <iostream.h>

    int main ()
    {

    cout<<"hello"<<endl;

    return 0;
    }



    the run screen just flashes up and goes away in a matter of 1/10th of a second. this compiler has major issues.
    That has nothing to do with the compiler... try this:
    Code:
    #include <iostream.h>
    
    int main ()
    {
    
        cout<<"hello"<<endl;
        cin.get();
        return 0;
    }

  7. #7
    Registered User
    Join Date
    Nov 2002
    Posts
    14
    heres my program code so far:

    #include <iostream.h>
    #include <string.h>
    #include <ctype.h>
    #include <iomanip.h>

    struct offPlayer
    {
    char Oname[20];
    int runYards, passYards, recYards, points;
    double minutes;
    };

    struct defPlayer
    {
    char Dname[20];
    int tackles, assists, fumbRec, intercept;
    double minutes;
    };

    int main ()
    {
    int entry=1, x;

    offPlayer olist[5];
    defPlayer dlist[5];

    char Oname[20];

    for (x=0; x<5; x++)
    {
    cout<<"Enter the name of the number "<<entry<<" offensive player"<<endl;
    cin.getline(olist[x].Oname, 20);


    cout<<"Enter the run yards for the number "<<entry<<" offensive player"<<endl;
    cin>>olist[x].runYards;

    cout<<"Enter the pass yards for the number "<<entry<<" offensive player"<<endl;
    cin>>olist[x].passYards;

    cout<<"Enter the recieving yards for the number "<<entry<<" offensive player"<<endl;
    cin>>olist[x].recYards;

    cout<<"Enter the number of points for the number "<<entry<<" offensive player"<<endl;
    cin>>olist[x].points;

    cout<<"Enter the number of minutes played for the number "<<entry<<" offensive player"<<endl;
    cin>>olist[x].minutes;

    entry++;

    fflush(stdin);
    }

    entry=1;

    for (x=0; x<5; x++)
    {
    cout<<"Enter the name of the number "<<entry<<" defensive player"<<endl;
    cin.getline(dlist[x].Dname, 20);


    cout<<"Enter number of tackles for the number "<<entry<<" defensive player"<<endl;
    cin>>dlist[x].tackles;

    cout<<"Enter the number of assists for the number "<<entry<<" defensive player"<<endl;
    cin>>dlist[x].assists;

    cout<<"Enter the number of fumbles recieved for the number "<<entry<<" defensive player"<<endl;
    cin>>dlist[x].fumbRec;

    cout<<"Enter the number of interceptions for the number "<<entry<<" defensive player"<<endl;
    cin>>dlist[x].intercept;

    cout<<"Enter the number of minutes played for the number "<<entry<<" defensive player"<<endl;
    cin>>dlist[x].minutes;

    entry++;

    fflush(stdin);
    }


    return 0;

    }

    so why does it say
    "#include expects 'FILENAME' or <FILENAME>" ?

    it works on codewarrior. please help.

  8. #8
    Registered User
    Join Date
    Nov 2002
    Posts
    87
    I find that placing SYSTEM("PAUSE") anywhere works the same as getch() and I prefer it.

    Try taking out the .h as well.

    I have had similar problems with #include when editing a program in MSVC++ and it works. Then placing it in DEV-C++. Check your header file links are in the right places under compiler options, you may have accidently changed them.
    **********************
    *==================*
    * Many Can. One Must... *
    *==================*
    **********************

  9. #9
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    I'd also recommend downloading gcc 3.2. But since even Dev-C++ 4.9.6 pre-dates gcc 3.2 the IDE doesn't always display its its error messages correctly (everything compiles fine as far as I know). I usually use makefiles anyway.

    The C Programming Language

    int fflush(FILE *stream)
    On an output stream, fflush causes any buffered but unwritten data to be written; on an input stream, the effect is undefined.
    I compiled your code just fine (using Dev-C++ 4.9.6's compile button). You need to go to Tools->Compiler->Directories and make sure that all of the info is correct. That is most likely your problem.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. New to Dev C++/<windows.h>...
    By Cilius in forum C++ Programming
    Replies: 3
    Last Post: 02-23-2005, 01:05 AM
  2. Glut and Dev C++, Programs not Quitting?
    By Zeusbwr in forum Game Programming
    Replies: 13
    Last Post: 11-29-2004, 08:43 PM
  3. Dev C++ Compiler, Indentation?
    By Zeusbwr in forum C++ Programming
    Replies: 3
    Last Post: 10-21-2004, 06:13 AM
  4. Dev C++ compiler question
    By exluddite in forum C++ Programming
    Replies: 1
    Last Post: 10-16-2004, 09:31 PM
  5. C Compiler
    By SAMSEIED in forum C Programming
    Replies: 5
    Last Post: 06-06-2002, 05:44 PM