简体   繁体   中英

How to use PC name inside ifdef ifndef statments

How can I use my PC name in the ifdef statement instead of using the ONLINE_JUDGE macro.

I use the following debugging code where debug.h has all the debugging functions and when the ONLINE_JUDGE is not defined then my debugging function calls maps to debug.h else it just maps to empty deb(...)

 #ifndef ONLINE_JUDGE #include "debug.h" #else #define deb(...) #endif

I want to use something like

#ifdef MYPC #include "debug.h" #else #define deb(..) #endif

Thanks in advance for helping me out:)

you can use -DMYPC flag in g++ building:

 g++ -DMYPC -o test main.c

then

#IFDEF MYPC #include "debug.h" #else #define deb(..) #ENDIF

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