Menu

Header file not found at compile

Rob Bayd
2010-03-18
2012-09-26
  • Rob Bayd

    Rob Bayd - 2010-03-18

    I'm trying to compile a C source program that includes a few header files and
    functions(user written) in the same library as the source file. The source,
    header, and function files are in the following directory :
    C:\Robs_Stuff\C_Source_Files\C. I added this directory to Compiler-Options-
    Directories. The compiler log states that it can't find the #include files in
    C:\Robs_Stuff\C_Source_Files\C\C. My question is why is the compiler appending
    a \C to the end of the directory that I added to the Compiler-Options-
    Directories. One entry from the Compiler log follows:

    \RobsStuff\C Source Files\C\convert2metric.c C:\RobsStuff\C Source
    Files\C\C getinteger.h: No such file or directory.

    gcc.exe "C:\RobsStuff\C Source Files\C\convert2metric.c" -o "C:\RobsStuff\C
    Source
    Files\C\convert2metric.exe" -I C:\RobsStuff\CSource_Files\C, -L
    C:\RobsStuff\C_Source_Files\C -I"C:\Dev-Cpp\include"
    -I"C:\RobsStuff\C_Source_Files" -L"C:\Dev-Cpp\lib"
    C:\RobsStuff\C
    Source_ Files\C\convert2metric.c:3:25: getinteger.h: No such
    file or directory

    Any help would be appreciated as I've searched and come up short.

     
  • cpns

    cpns - 2010-03-18

    The gcc command line you posted does not match what you said in the prevoius
    text, there is no \C added.

    You should post the entire Compile Log text, not just a fragment.

    You only need to add an include path when the file being included is in a
    different folder than the source being compiled. Use:

    #include "getinteger.h"
    

    with "..." rather than <...> to force the compiler to look in the source
    folder before looking in the -I path list.

    Also do not add project specific paths to "Compiler-Options-Directories",
    rather create a project and add teh path to the project options, otherwise
    your project will not easily port between Dev-C++ installations. You might
    consider using relative paths rather than absolute ones to allow the project
    to be moved easily.

    You appear to not be using a project and are building a single source file
    application; in which case what is getinteger.h for since you are not linking
    any associated object file or library?

     
  • Rob Bayd

    Rob Bayd - 2010-03-19

    Thanks for the explanation - appreciate your time. I might add this is my
    first use of Dev-C and this is just a test application that currently runs
    fine(copied as is - single source file application) on a Unix system with one
    main function, several . Just testing to see if Dev-C is a viable option on
    Windows systems.

    In regards to the compile log line listed first with the \C appended(first
    line in compile log) and the second example(last few lines in compile log(same
    run)) where I explicitly added the -I, -L instructions to the compiler and the
    \C appended wasn't listed - that was the basis for my question. In addition, I
    created a separate path with (C:\RobsStuff\C_Source_Files) and a C was also
    appended onto it(. . . Files\C). This seemed like unusual and unnecessary
    behavior because it took the liberty to append the \C to it and than
    complained it could't find the directory name it was responsible for creating
    . Again, thanks much and I will implement your suggestions.

     
  • cpns

    cpns - 2010-03-19

    There is a reason why I asked for the _complete _Compile Log. Is there a
    reason you did not post it?

    I note that while \C appears to have been appended, the C: drive letter
    appears to have been removed. I suspect that these are related.

    Are you really using Dev-C? Surely Dev-C++? What version? If you are not
    useing Dev-C++ 4.9.9.2, I suggest all bets are off.

     

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.