cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Linking to static library
Linking to static library
Jul 16, 2014 at 12:06am UTC
n4nature
(245)
I have built a static library that contains a macro. From a separate exe, I am calling this macro, but it doesn't work.
The compilation of the static library and that of the exe went okay.
Static lib contains just the macro definition.
Exe contains call to this macro.
Is there anything else that I need to do for this to work?
Thanks!
Jul 16, 2014 at 12:26am UTC
helios
(17574)
Macros are not link time symbols. A macro can be neither exported by a library nor imported by a program.
You can only use a macro by including the file that defines it.
Jul 16, 2014 at 7:53am UTC
Jaybob66
(534)
Macros are preprocessor items, they are processed befor ethe compiler even sees the source code.
think of them as text replace in source code because thats what they are.
here's a silly example to demonstrate;
1
2
3
4
5
6
7
#define { BEGIN
#define } END
while
(
true
) BEGIN cout <<
"in the loop"
; END
Jul 16, 2014 at 8:16pm UTC
iQChange
(374)
The oposite Jaybob666, #define BEGIN {, #define END }
Jul 17, 2014 at 8:15am UTC
Jaybob66
(534)
@iQChange,
oops a daisy!
Topic archived. No new replies allowed.