Sorry for posting such a lowly beginner's question, but I just still don't know my way around Visual Studios yet. I'm trying to compile a code in C++ Visual Studios:
#include "Banana.h"
int main(int argc, char* argv[])
{
fruit::Banana banana;
banana.dance();
return 0;
}
and I'm getting an error
fatal error C1083: Cannot open include file: 'Banana.h': No such file or directory
But in the Solution Explorer under the project that I'm working with there is a source folder labeled "fruit/Header Files" and within that folder is "Banana.h". I thought that everything in the source folders within the same project were automatically on the source path. What gives?
Open the project's Property Pages dialog box. For details, see Set C++ compiler and build properties in Visual Studio. Select the Configuration Properties > C/C++ > General property page. Modify the Additional Include Directories property.
When the header file is not found, the compiler generates a C1083 error. The fix for this problem is to use the correct file, not to add the header file or directory to the build.
Try reinstalling mingw. Basically, the problem is with header files. I think you should try reinstalling mingw, adding it to system path again or try installing the extension in vscode.
The file stdafx. h is usually used as a precompiled header file. Precompiled headers help to speed up compilation when a group of files in a project do not change.
You will need to configure additional include paths. If you go to the Project Properties, you'll find it under Configuration Properties
, C/C++
at the top.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With