"Error C1083: Cannot open include file" but I have a path to the include file

33,218

Possible solution 1:

#include "../myProject.h"

Possible solution 2:

Project Properties ~> C/C++ ~> General ~> Additional Include Directories, try to set there path relative to the directory where is your .sln (solution) file. If the solution is in U:\Software Development\c++ projects\myProject\ then try to set it to $(SolutionDir)myProject

Share:
33,218
sigil
Author by

sigil

Updated on April 04, 2020

Comments

  • sigil
    sigil about 4 years

    Related to this question, I have included a header file in the code for a console app that I'm using to test a DLL, but Visual Studio is returning the following error:

    error C1083: Cannot open include file: 'myProject.h': No such file or directory
    

    But I have included the folder path for myProject.h in Additional Include Directories. I also tried entering it under Configuration Properties->Debugging->Environment as a "PATH=<...>" value. The path is: U:\Software Development\c++ projects\myProject\myProject, and when I go to that folder, I can see myProject.h in the folder.

    #include "stdafx.h"
    #include <iostream>
    #include "myProject.h"
    
    
    using namespace std;
    
    int main()
    {
        cout << myProject::FileOperator::openDoc(1799,29);
    }
    

    When I type "#include", the Intellisense shows me just 3 items: the Debug folder corresponding to U:\Software Development\c++ projects\myProject\myProject\Debug,stdafx.h, and targetver.h.