Getting a "bad include syntax" when trying to compile a test programPLEASE HELP - Minix

This is a discussion on Getting a "bad include syntax" when trying to compile a test programPLEASE HELP - Minix ; Hello, I have the following simple program: #include main(int argc, char**argv) { printf("This is just a test"); } In minix i have the file saved as testApp.c in my directory /usr/src/ ts. When I try and compile it using cc ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Getting a "bad include syntax" when trying to compile a test programPLEASE HELP

  1. Getting a "bad include syntax" when trying to compile a test programPLEASE HELP

    Hello,

    I have the following simple program:

    #include

    main(int argc, char**argv)
    {
    printf("This is just a test");

    }

    In minix i have the file saved as testApp.c in my directory /usr/src/
    ts. When I try and compile it using cc testApp.c or cc -o test
    testApp.c I get the following message:

    "testApp.c", line 2: bad include syntax

    I cannot figure out what is wrong. I am copying "test" programs I
    have found and keep getting that same message.

    Thanks for your time and any help.


  2. Re: Getting a "bad include syntax" when trying to compile a testprogram PLEASE HELP

    On 18 Feb, 04:12, jibbera...@hotmail.com wrote:
    > Hello,
    >
    > I have the following simple program:
    >
    > #include
    >
    > main(int argc, char**argv)
    > {
    > printf("This is just a test");
    >
    > }
    >
    > In minix i have the file saved as testApp.c in my directory /usr/src/
    > ts. When I try and compile it using cc testApp.c or cc -o test
    > testApp.c I get the following message:
    >
    > "testApp.c", line 2: bad include syntax
    >


    Hi,
    Maybe the cc compiler expects a return value for the main function:

    #include

    int main(int argc, char**argv)
    {
    printf("This is just a test");
    return 0;
    }

    try if it works.

  3. Re: Getting a "bad include syntax" when trying to compile a testprogram PLEASE HELP

    On 02/18/08 04:12, jibberalan@hotmail.com wrote:
    > Hello,
    >
    > I have the following simple program:
    >
    > #include
    >
    > main(int argc, char**argv)
    > {
    > printf("This is just a test");
    >
    > }
    >
    > In minix i have the file saved as testApp.c in my directory /usr/src/
    > ts. When I try and compile it using cc testApp.c or cc -o test
    > testApp.c I get the following message:
    >
    > "testApp.c", line 2: bad include syntax
    >
    > I cannot figure out what is wrong. I am copying "test" programs I
    > have found and keep getting that same message.
    >
    > Thanks for your time and any help.
    >


    If I recall correctly that kind of error is caused by the line
    terminator. The compiler expects the lines to be terminated by a line
    feed ('\n') while your file may have lines terminated by carriage
    return line feed ('\r\n').

    This usually happens if you edit the file with an editor from Windows.
    Using vi check if the lines are terminated bye a ^M and remove it.

    Ciao
    Giovanni
    --
    A computer is like an air conditioner,
    it stops working when you open Windows.
    Registered Linux user #337974 < http://giovanni.homelinux.net/ >

+ Reply to Thread