Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 464
sigil Avatar asked Oct 12 '13 00:10

sigil


1 Answers

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

like image 97
LihO Avatar answered Nov 05 '22 22:11

LihO