简体   繁体   中英

Visual Studio 2012 Error: Cannot open source file

I have source code (header and source files)of a library. I need to include the source code in my existing project. For that purpose i have copied the entire library source code directory into visual studio project folder then i included that directory to VS by using include to project option. Fine.

There is a header file say "xh" in the library source code directory which defines some macros, and there are some other header files say "yh" and "zh" which are using those macros defined in "xh". But visual studio is not recognising those macros at all when i included those ("yh" and "zh") header files in my main class. Visual Studio generates the error "Cannot open this source file".

Actually "yh" and "zh" can not find macros defined in "xh". How to solve this error? Is there some kind of setting need in the project properties?

My second question is that how to include some programming files in my project correctly so that i can use that library functionality correctly? I have also Include the header directories in configuration properties > VC++ Diectories > Include Directories.

Third question is that is there a way in which i don't have to include the source code to my project? remember i don't have .lib file or .dll file of that library and i cannot compile that library also.

Have you add

#include <x.h>

or

#include "x.h"

Are library files in a sub-folder? if Yes try

#include ".\subfoldername\x.h"

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