469,282 Members | 1,949 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

compiler and linker directives in Visual C++ 2005


Good afternoon

Is there a way to tell the compiler and linker where to look for my
header files and libraries directly on the code?
(I'm not talking about changing
project properties, linker, additional lib dirs... )

I can tell what libs I want to use, with this:
eg.
#define MATLAB_LIB_1 "C:\\Program Files\\MATLAB71\\extern\\lib\\win32
\\microsoft\\msvc70\\libeng.lib"
#pragma comment(lib, MATLAB_LIB_1)

As you see I'm telling the full pathname for libeng.lib
How do I tell the linker where to look for libs?
And how do I tell the compiler where to look for headers?

TIA
--
fade
email: fade(*AT*)forward(*dot*)to
Feb 1 '07 #1
3 2470
"fade" <do****************@mail.comwrote in message
news:Xn********************@194.65.14.158...
>
Good afternoon

Is there a way to tell the compiler and linker where to look for my
header files and libraries directly on the code?
(I'm not talking about changing
project properties, linker, additional lib dirs... )

I can tell what libs I want to use, with this:
eg.
#define MATLAB_LIB_1 "C:\\Program Files\\MATLAB71\\extern\\lib\\win32
\\microsoft\\msvc70\\libeng.lib"
#pragma comment(lib, MATLAB_LIB_1)

As you see I'm telling the full pathname for libeng.lib
How do I tell the linker where to look for libs?
And how do I tell the compiler where to look for headers?
You use the command line options and/or project settings.

Other than the use of #pragma comment that you've already discovered, there
are no other mechanisms that I'm aware of to pass absolute paths to the
linker/compiler from within the source code itself. That's a very unusual
thing to want to do that goes against most guidelines for sensible
development (imagine moving your code to another machine), so I don't expect
you're going to find exactly what you're looking for.

-cd
Feb 1 '07 #2

"fade" <do****************@mail.comwrote in message
news:Xn********************@194.65.14.158...
>
Good afternoon

Is there a way to tell the compiler and linker where to look for my
header files and libraries directly on the code?
(I'm not talking about changing
project properties, linker, additional lib dirs... )

I can tell what libs I want to use, with this:
eg.
#define MATLAB_LIB_1 "C:\\Program Files\\MATLAB71\\extern\\lib\\win32
\\microsoft\\msvc70\\libeng.lib"
#pragma comment(lib, MATLAB_LIB_1)

As you see I'm telling the full pathname for libeng.lib
How do I tell the linker where to look for libs?
Doesn't your method do that?

Remember you can use automatic concatenation of string literals to merge
paths with filenames.

And how do I tell the compiler where to look for headers?
#include accepts a relative or absolute path, as well as a bare filename.
>
TIA
--
fade
email: fade(*AT*)forward(*dot*)to

Feb 1 '07 #3
Remember you can use automatic concatenation of string literals to merge
paths with filenames.
Thank you! ;)

fade
email: fade(*AT*)forward(*dot*)to
Feb 5 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Thomas Meier | last post: by
6 posts views Thread by ik | last post: by
4 posts views Thread by Jeremy Watts | last post: by
12 posts views Thread by Baloff | last post: by
5 posts views Thread by Ondrej Spanel | last post: by
3 posts views Thread by Steve Baer | last post: by
43 posts views Thread by Jeremy Thomson | last post: by
2 posts views Thread by Oneironaut | last post: by
reply views Thread by norseman | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.