简体   繁体   中英

How to import external .hpp file?

i want to achieve this:

I have some definitions in ah header, for example:

#define myVariable 0x01

This.h file is placed somewhere on my PC for example in C:\MyProgram, MyProgram.exe is in the same folder. I want to be able to change directly myVariable and this change would be effective even if i don't recompile the.exe , like the h file is external to this exe and not internal/compiled in it.

What is the simplest way to achieve this? Thanks !

This is not how header files work. Really simplified: when you compile your program the lines with #include gets replaced with the actual contents of the header file, it is just copied in. So what's in there is there to stay.

What you need is to read a file with for example std::ifstream where the file is located somewhere the program is allowed to read it.

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