N
NvrBst
This seems like a very basic question but I can't seem to google the
answer. Should the .H and .CPP always be in the same directory? Or
is it safe to put all my ".h" file in a "inc" folder, and all my .cpp
files in a "src" folder?
MSDN says (#include"") "This form instructs the preprocessor to look
for include files in the same directory of the file that contains the
#include statement, and then in the directories of any files that
include (#include) that file.". How is the 2nd part of the statment
possible? For example
MyProj1/inc/*.h
MyProj1/src/*.cpp
MyProj2/inc/*.h
MyProj2/inc/*.cpp
Say a file in MyProj2 wants to include something in the "MyProj1/inc"
folder, it'd go "include <MyProj1File.h>" and then add -I"path/
MyProj1/inc" to the command line, would I also have to add the source
directory -I"path/MyProj2/src"?
This is just a cosmetic thing, I'm a little new to C++ and wanted to
know if I'd be laughed out of the room by having seperate "inc" and
"src" folders, and also how a header file finds it's source file (aka
just magic, the -I flag, or something else).
answer. Should the .H and .CPP always be in the same directory? Or
is it safe to put all my ".h" file in a "inc" folder, and all my .cpp
files in a "src" folder?
MSDN says (#include"") "This form instructs the preprocessor to look
for include files in the same directory of the file that contains the
#include statement, and then in the directories of any files that
include (#include) that file.". How is the 2nd part of the statment
possible? For example
MyProj1/inc/*.h
MyProj1/src/*.cpp
MyProj2/inc/*.h
MyProj2/inc/*.cpp
Say a file in MyProj2 wants to include something in the "MyProj1/inc"
folder, it'd go "include <MyProj1File.h>" and then add -I"path/
MyProj1/inc" to the command line, would I also have to add the source
directory -I"path/MyProj2/src"?
This is just a cosmetic thing, I'm a little new to C++ and wanted to
know if I'd be laughed out of the room by having seperate "inc" and
"src" folders, and also how a header file finds it's source file (aka
just magic, the -I flag, or something else).