none
Visual Studio is blind!

    Question

  • Hello. So I'm sure I'm overlooking something silly. Hopefully somebody can point out my error.

    This works in C++:

    #include "external\glew-1.13.0\include\GL\glew.h"
    
    int main()
    {
    }

    Now, I have defined "external\glew-1.13.0\include" in the project's property page under "C/C++ -> General -> Additional Include Directories". I have done this for all Configurations.

    But this does not work:

    #include "GL\glew.h"
    
    int main()
    {
    }

    I get "fatal error C1083: Cannot open include file: 'GL\glew.h': No such file or directory"

    How can this be? I told VS precisely where to find it. I even tried using the absolute directory starting with C:\...\.... It's getting frustrating. I've made certain that there is no potentially conflicting include directory defined under "VC++ Directories -> Include Directories" and I've tried deleting the .sdf file in the solution directory. What am I missing?

    Thursday, January 14, 2016 9:57 AM

Answers

  • If you have added the additional include folder of "external\glew-1.13.0\include" via a property page, then you probably want to specify it relative to the property page itself.

    Assuming you have a glew.props in the external\glew-1.13.0 folder then you could specify glew.props would set its additional include directories to this:

    $(MSBuildThisFileDirectory)\include;%(AdditionalIncludeDirectories)

    Then your project would add external\glew-1.13.0\glew.props to its property pages.

    [The following is less likely, but I'll explain just in case:] If you want to put your property page elsewhere, then you may need to specify a different relative path.  For example, if your glew.props were in the same folder as "external" then it would specify:

    $(MSBuildThisFileDirectory)\external\glew-1.13.0\include;%(AdditionalIncludeDirectories)

    Thursday, January 14, 2016 4:24 PM

All replies

  • Is it the only definition in Additional Include Directories or there are several ones separated by ‘;’?

    Also note that the option can be specified for separate files too. Right-click the file in Solution Explorer, go to Properties and make sure that the field does not conflict with project-level setting, or select “<inherit>” from dropdown list.




    • Edited by Viorel_MVP Thursday, January 14, 2016 11:49 AM
    Thursday, January 14, 2016 11:48 AM
  • You know, I decided to put the whole path in my include (since that worked) and come back to it later (so I could move on and get something done). During the course of fixing linker errors and other things with my project, I went back and tried again with glew.h and now it is working as expected. I still don't know why I got the error.

    For the record, I find the property page gui to be extremely unintuitive and cumbersome to deal with. %(additional dependencies), <different options>, some things bold some things not, placing a dependency in all configurations sometimes causes it to "disappear" because it gets placed separately under each individual configuration category and thus is no longer editable in one place. It is a complete mess.

    Thank you for the response though!

    Thursday, January 14, 2016 12:49 PM
  • If you have added the additional include folder of "external\glew-1.13.0\include" via a property page, then you probably want to specify it relative to the property page itself.

    Assuming you have a glew.props in the external\glew-1.13.0 folder then you could specify glew.props would set its additional include directories to this:

    $(MSBuildThisFileDirectory)\include;%(AdditionalIncludeDirectories)

    Then your project would add external\glew-1.13.0\glew.props to its property pages.

    [The following is less likely, but I'll explain just in case:] If you want to put your property page elsewhere, then you may need to specify a different relative path.  For example, if your glew.props were in the same folder as "external" then it would specify:

    $(MSBuildThisFileDirectory)\external\glew-1.13.0\include;%(AdditionalIncludeDirectories)

    Thursday, January 14, 2016 4:24 PM