How would I include a lib that is in a different folder than vc7? e.g. the lib is in C:\abc\Lib. Is it possible to set something like a PATH value in C++ to allow it to look for libraries in specific places? What is the standard practice?
Thanks.
Printable View
How would I include a lib that is in a different folder than vc7? e.g. the lib is in C:\abc\Lib. Is it possible to set something like a PATH value in C++ to allow it to look for libraries in specific places? What is the standard practice?
Thanks.
in which case, use something along the lines ofNote the double-backslashes. Backslash is a special character in C++ string literals for using 'escape sequences' - The double backslash is the escape sequence for the backslash itselfCode:#include "C:\\abc\\Lib\\my_header.h"
If you don't like that, you can usually use forward-slash instead:Code:#include "C:/abc/Lib/my_header.h"
Edit - if your header files are in a sub-folder of the current project, then you don't need to specify the full path, just the subfolder and filename
would it make a difference if the path to the library is set in the user environment variables (win xp)?
In the project settings you can add
Project Properties/Configuration Properties/C++/General/Additional Include directories
The new path where the h-files will be looked for
Or You can open
Tools/Options/Projects adn Solutions/VC++ Directories
And add some directories to the Include files list
This will affect all projects
You should never use absolute paths inside include statements. It makes it much harder to port the code to even another directory on the same machine, nevermind elsewhere.
Use Vart's suggestion of setting search paths in the IDE
The escapes are not processed in preprocessor directives.Quote:
Originally Posted by Bench82
it should be
But still forward slashes are a lot better. Best solution is definately vart's way to add a -I compiler switchCode:#include "C:\abc\Lib\my_header.h"
Kurt