Hello
I have a C++ project A which has to use heather/source files of project B.
When I do include "B.h" then B's heather can't be seen because B and A are in a different sub-folders of the same folder.What can I do
thank you

Recommended Answers

All 6 Replies

#include "..//Folder_Name//File.h"

or

#include "../Folder_Name/File.h"

I think this should work out.
You need to traverse to the previous directory and then to a sub-directory.

Probably the simplest way to go:

#include "../projectBfolder/B.h"

or add the project B folder to include paths list of the project A. How to do it depends on your IDE, of course...

#include <..//Folder_Name//File.h>

I think this should work out.
You need to traverse to the previous directory and then to a sub-directory.

Using '<' and '>' works only if the header files are in the compiler's header files directory ...

Probably the simplest way to go:

#include "../projectBfolder/B.h"

or add the project B folder to include paths list of the project A. How to do it depends on your IDE, of course...

This should work fine :) ...

Using '<' and '>' works only if the header files are in the compiler's header files directory ...

This should work fine :) ...

Oops. I actually meant to use "quote" but ended up using "<" sorry...!!!

I use VC++. I tried to traverse to a different directory but I failed.
Thank you very match. I think the best is to include the path list

Thanks boys. i got it using relative paths. thank you very match

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.