简体   繁体   中英

Cannot open header file in Visual Studio 2012

I am using Visual Studio 2012 and trying to import header files in the project, but have been failing miserably. Here is what I have tried to do:

#include "gevents.h"
#include "gobjects.h"
#include "gwindow.h"

int main(){

     int x=1;

     return 0;
}

I have added these three header files in the project location: C:\\Users\\Shaby\\Documents\\Visual Studio 2012\\Projects\\ConsoleApplication39

In addition, I have also gone to Project properties ->Configuration Propertues -> C/C++ ->General and included the above path location in "Additional Include Directories" but this had yielded nothing. Instead, I am getting the following error:

Unable to start program C:\\Users\\Shaby\\Documents\\Visual Studio 2012\\Projects\\ConsoleApplication39\\Debug\\ConsoleApplication39.exe The system cannot find the file specified

@Usman Khan , I have one solution for your problem.In Solution Explorer Window (if not opened then press Ctrl+Alt+l ) you can see you project name.Right click on it and than Add > Existing Item . Now select your header files which you want to include & press Add . Done :) .

why are you making it complex, just keep it simple.After creating your project. Open solution explorer. Under your project name you would see a folder "header files" , add your header files in it (your header files should have ".h" extension) and then to use them include them in your source files

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM