简体   繁体   中英

visual studio directories and include paths

someone please help me with this issue, i do not think i understand this clearly:

in visual studio when i create a solution it asks me for a path where to create it

say for the directory where to create i say c:\\work\\ and i say "sol1" for the name of the directory.

what i see is in c:\\work\\ a directory is created with name "sol1" inside "sol1" there is another director "sol1" and inside that i see folders like "Debug", "sol1", sol1.sln.

now say i have some preexisting code inside c:\\work\\codes\\code1.cpp

i add code1.cpp to the visual sudio project "sol1" adn then say i have something like #include "codes\\code2.h" inside the first line of code1.cpp

so now how should indicate the additional include directories ? if i say something like "../.." for additional include directories what is happening. what is my reference directory starting from which other directories should be visible.

It would be very kind of someone to clarify this issue. Please explain with a bit of detail.

Thanks.

If you use eg

#include "code2.h"

then the pre-processor (the program that handles the #include directive) should look for code2.h in the same directory as the source file where you have the #include .

So in your case, since you do this #include in code1.cpp and it seems like code2.h is in the same directory, you should #include like above.

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