Menu

Problem compiling C program

J H
2008-05-18
2012-09-26
  • J H

    J H - 2008-05-18

    Hi,

    I tried to compile the following simple C program in DEV c++ 4.9.9.2:

    include <stdio.h>

    int main(void){
    printf("Testing");

    return 0;
    

    }

    I got 25 compilation errors and most of them are about type specifier omitted in stdio.h. I am using windows vista business edition and the example C++ program works. Could anyone help me with this problem?

    Thanks in advance!

    Regards,

    JH

     
    • cpns

      cpns - 2008-05-20

      Since it is identical to that provided with Dev-C++, Installing a separate copy of MinGW is a lot of work for no real benefit. You may still end up where you are now, just with far less disk space, and a bit of wasted life.

      Just post your log again. It will be far easier for us to help you with a standard installation than one you have customised in any case.

      The lines the error messages refer to all use the same __VALIST macro. I am willing to bet that you still have the aforementioned options set. Did you check the log to make sure they were truly disabled? We can't tell because you chose not to post that - again!

      Clifford

       
    • cpns

      cpns - 2008-05-18

      >> I got 25 compilation errors and most of them
      >> are about type specifier omitted in stdio.h.

      Did you? That's nice for you.

      Error messages (and in fact the whole build log) contain information that is useful in diagnosing build issues. Why not give us that benefit and post the Compile Log text!?

      We can see that your code is valid and that you are using the most recent version. You posted all the stuff that is good and usual (and therefore contains no useful information), and merely 'described' the stuff that is unusual and might actually provides any clue to your problem!

      Is your attempt to hide this information some sort of experiment in Object Oriented problem solving!? ;-)

      Clifford

       
    • Wayne Keen

      Wayne Keen - 2008-05-18

      Please take a moment and look at the thread titled "Please Read Before Posting a Question", in particular, the section on the "Basic 3" - the pieces of information that a smart questioner provides to get better answers, faster, without having to rely on our psychic friends network subscription. ;)

      Wayne

       
      • J H

        J H - 2008-05-19

        This is the output compile log:

        Compiler: Default compiler
        Executing gcc.exe...
        gcc.exe "E:\My_Documents\Cprograms\printing.c" -o "E:\My_Documents\Cprograms\printing.exe" -ansi -traditional-cpp -I"C:\Dev-Cpp\bin" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\bin" -L"C:\Dev-Cpp\lib"
        In file included from E:\My_Documents\Cprograms\printing.c:1:
        C:\Dev-Cpp\include\stdio.h:210: type specifier omitted for parameter
        C:\Dev-Cpp\include\stdio.h:211: type specifier omitted for parameter
        C:\Dev-Cpp\include\stdio.h:212: type specifier omitted for parameter
        C:\Dev-Cpp\include\stdio.h:213: type specifier omitted for parameter
        C:\Dev-Cpp\include\stdio.h:218: type specifier omitted for parameter
        C:\Dev-Cpp\include\stdio.h:218: parse error before )' C:\Dev-Cpp\include\stdio.h: In functionint vsnprintf(...)':
        C:\Dev-Cpp\include\stdio.h:219: s' undeclared (first use this function) C:\Dev-Cpp\include\stdio.h:219: (Each undeclared identifier is reported only once C:\Dev-Cpp\include\stdio.h:219: for each function it appears in.) C:\Dev-Cpp\include\stdio.h:219:n' undeclared (first use this function)
        C:\Dev-Cpp\include\stdio.h:219: format' undeclared (first use this function) C:\Dev-Cpp\include\stdio.h:219:arg' undeclared (first use this function)
        C:\Dev-Cpp\include\stdio.h: At top level:
        C:\Dev-Cpp\include\stdio.h:220: type specifier omitted for parameter
        C:\Dev-Cpp\include\stdio.h:222: type specifier omitted for parameter
        C:\Dev-Cpp\include\stdio.h:224: type specifier omitted for parameter
        C:\Dev-Cpp\include\stdio.h:432: type specifier omitted for parameter
        C:\Dev-Cpp\include\stdio.h:433: type specifier omitted for parameter
        C:\Dev-Cpp\include\stdio.h:434: type specifier omitted for parameter
        C:\Dev-Cpp\include\stdio.h:435: type specifier omitted for parameter
        C:\Dev-Cpp\include\stdio.h:467: type specifier omitted for parameter
        C:\Dev-Cpp\include\stdio.h:467: parse error before `)'
        C:\Dev-Cpp\include\stdio.h:469: type specifier omitted for parameter
        C:\Dev-Cpp\include\stdio.h:471: type specifier omitted for parameter
        C:\Dev-Cpp\include\stdio.h:473: type specifier omitted for parameter

        Execution terminated

        This is the program:

        include <stdio.h>

        int main(void){
        printf("Testing");

        return 0;
        

        }

        Something must have gone wrong with the installation process? Thanks a lot!

        JH

         
    • cpns

      cpns - 2008-05-19

      Unless you have a really good reason to have -traditional-cpp set, don't! That is your problem. I would advise against -ansi as well to be honest. In fact, unless you have a specific need, and are very sure what they do, don't set any non-default options other than perhaps -Werror -Wall -Wformat.

      Clifford

       
    • J H

      J H - 2008-05-20

      Hi Clifford, I tried your advise and set all compilation options to default, but the same problem exist, I am going to install a separate mingw compiler in a diffrernt folder and include the files in the directories of compiler option...

       
      • Wayne Keen

        Wayne Keen - 2008-05-20

        When you are asked to do something, please do not respond with just "I tried what you ask, and the problem remains", post your Basic 3 again. Remote debugging is a hard process, you need to be VERY methodical.

        Wayne

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.