user1496542
user1496542

Reputation: 559

Macro causing linker errors

I have a bunch of macros defined in a library for example called MY_LIB.so I built and compiled it successfully. Example:

#define DOSOMETHING() function()

#define ANOTHER() function2()

When I use it in another project, I linked it in my Makefile using -lMY_LIB and I am getting an undefined reference error to function(). I click on it and it brings me to DOSOMETHING() macro. How do I get around with linker errors from macros?

Upvotes: 0

Views: 623

Answers (1)

Andrew
Andrew

Reputation: 24846

Macro is nothing more than just a copy of it content to code. The linker sais that function is not implemented. So just provide an implentation

Upvotes: 3

Related Questions