locked
fatal error cannot open include file RRS feed

  • Question

  • Hi!

    I created a Win 32 console application and copied one header file to the header folder. When I include this header file, I get this error: cannot open include file.

    #include "glut.h"
    
    int main() {
    	return 0;
    }
    Please, help me.
    Saturday, November 28, 2009 6:57 PM

Answers

  • The thing that you must remember is that headers under the visual studio project explorer is not a physical directory on the hard disk but instead just a filter. To actually get the compiler to find the header you either need to copy it into the project directory (which creating a new file actually does, it creates it in the project directory) or set the compiler's additional include directory to look for the path where glut.h exists on your computer.


    Visit my (not very good) blog at http://c2kblog.blogspot.com/
    • Proposed as answer by Wesley Yao Monday, November 30, 2009 6:32 AM
    • Marked as answer by coutinhovr Tuesday, December 1, 2009 8:46 PM
    Sunday, November 29, 2009 5:12 AM

All replies

  • Quote>copied one header file to the header folder.

    Copied to *which* header folder?

    - Wayne
    Saturday, November 28, 2009 7:51 PM
  • Quote>I get this error: cannot open include file.

    Show the *complete* error message. Use Windows clipboard to copy and paste
    the message into a post here. Do *not* try to type it in or paraphrase.

    Note that many header files pull in other header files. The paths to these
    other files must be known to the compiler.

    - Wayne
    Saturday, November 28, 2009 7:54 PM
  • Hi.

    A Win 32 console application has three folders: Header Files, Resources Files, and Sources Files. I copied the the header file to the Header Files folder.

    The complete error message is:
    1>Compiling...
    1>main.cpp
    1>c:\documents and settings\master\meus documentos\visual studio 2008\projects\opengllesson1\opengllesson1\main.cpp(1) : fatal error C1083: Cannot open include file: 'glut.h': No such file or directory
    1>Build log was saved at "file://c:\Documents and Settings\master\Meus documentos\Visual Studio 2008\Projects\OpenGLLesson1\OpenGLLesson1\Debug\BuildLog.htm"
    1>OpenGLLesson1 - 1 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    Thank you!
    Saturday, November 28, 2009 11:16 PM
  • So. I created a new header file, then copied the content of the original header file, and it worked. So there must be some kind of link that doesn't exist when you simply copy the file. :/
    Sunday, November 29, 2009 1:04 AM
  • The thing that you must remember is that headers under the visual studio project explorer is not a physical directory on the hard disk but instead just a filter. To actually get the compiler to find the header you either need to copy it into the project directory (which creating a new file actually does, it creates it in the project directory) or set the compiler's additional include directory to look for the path where glut.h exists on your computer.


    Visit my (not very good) blog at http://c2kblog.blogspot.com/
    • Proposed as answer by Wesley Yao Monday, November 30, 2009 6:32 AM
    • Marked as answer by coutinhovr Tuesday, December 1, 2009 8:46 PM
    Sunday, November 29, 2009 5:12 AM