• Advertisement
Sign in to follow this  

[vc2005] library preproc. defines

This topic is 3763 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

okay i have 3 libraries: math render - uses math test app. - depends on render and math Now, in the vc2005 preprocessor defines i have added a define: NO_SEE i've got this at the top of my maths library:
#if defined(NO_SSE)
	#error("mwahahaha");
#else
	#error("drugs r bad!");
#endif

now, when my maths library compiles, I get "mwahahaha" spewed in the console as expected. when render compiles, i get "drugs r bad!". This is not what i was expecting! Can this be fixed without having to define NO_SEE in any library that uses my math library?

Share this post


Link to post
Share on other sites
Advertisement
No.

A library is a link-time entity. The preprocessor is a text processing program run prior to the compiler, which generates the object link files consumes by the linker. By the time the linker -- or even the cmpiler, technically -- sees the files what the preprocessor saw is long gone.

If you have a public library interface that depends on compile-time settings, you will need to make sure your library clients have the same compile-time settinsg, otherwise they will be looking for a different API than the one your library is presenting.

--smw

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement