简体   繁体   中英

ensuring uniform #defines among all object files

How can I ensure that all object files in my C++ project were compiled with the same conditional defines? Ie if they were not, I want to ensure a linker error pointing to the conflicting define. I want this to happen even with aggressive dead-code elimination by the compiler. Is there a known technique for this?

You can't; individual invocations of the compiler are just that - independent. The only way you can ensure this result is to have a single common source of all of the definitions, whether that's a command line specified in your makefile or a common header file, for example.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM