简体   繁体   中英

C++ include error from #include “DevEngine/Core.h”

So there are 1 files that I want to link together, Core.h and Events.h.

Core.h is in a folder called DevEngine and the Events.h file is in a folder called Events witch is inside DevEngine.

Here are the file directorys:

  • Core.h = src/DevEngine/Core.h
  • Events.h = src/DevEngine/Events/Events.h

I have added a #include "DevEngine/Core.h" : Cannot open include file: 'DevEngine/Core.h': No such file or directory DevEngine. I don't know where I have went wrong.

I have tried: #include "../DevEngine/Core.h". That still gives me a error.

You can do #include "../Core.h" .

You can also set the directories the compiler uses to search for the header files ( -I option in gcc ) and then use paths to those files relative to one of those directories. (See for example gcc documentation on search paths .)

This could be done differently depending on the way you are building the project.

For Visual Studio, look in this thread .

For CMake, use include_directories .

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