[vc2005] library preproc. defines

Started by
0 comments, last by Bregma 16 years, 5 months ago
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?
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

Stephen M. Webb
Professional Free Software Developer

This topic is closed to new replies.

Advertisement