![]() |
| | #1 |
| Registered User Join Date: Jan 2007
Posts: 223
| printing macro's at compile time something like Code: #define MACRO 4 #pragma warning MACRO |
| KIBO is offline | |
| | #2 |
| and the hat of Jobseeking Join Date: Aug 2001 Location: The edge of the known universe
Posts: 21,700
| What does the manual page tell you? |
| Salem is offline | |
| | #3 |
| Registered User Join Date: Jan 2007
Posts: 223
| a lot, but not what im looking for |
| KIBO is offline | |
| | #4 |
| Registered User Join Date: Jan 2007
Posts: 223
| nobody knows? |
| KIBO is offline | |
| | #5 |
| Cat without Hat Join Date: Apr 2003
Posts: 8,492
| Since you're looking for compiler-specific behaviour anyway, just try it out.
__________________ All the buzzt! CornedBee"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code." - Flon's Law |
| CornedBee is offline | |
| | #6 |
| Registered User Join Date: Jan 2007
Posts: 223
| jah, of course I tried it but it doesnt work. The original problem why I wanted to do this is solved but I'd still like to know how this is possible, could be handy next time. gcc docs say lots of things about pragma's, but nothing about printing macro's |
| KIBO is offline | |
| | #7 |
| Cat without Hat Join Date: Apr 2003
Posts: 8,492
| What does it print?
__________________ All the buzzt! CornedBee"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code." - Flon's Law |
| CornedBee is offline | |
| | #8 |
| C / C++ Join Date: Jan 2006 Location: The Netherlands
Posts: 312
| You can add macro's during compiling using this: Code: gcc source.c -DMACRO=4 Code: #define MACRO 4
__________________ Operating Systems: - Ubuntu 9.04 - XP Compiler: gcc |
| Ideswa is offline | |
| | #9 |
| Frequently Quite Prolix Join Date: Apr 2005 Location: Canada
Posts: 7,698
| You can use a sort of if-else construct. Code: #define DEBUG 1
#if DEBUG == 1
#pragma warning Debug mode on.
#elif DEBUG == 0
#pragma warning Release mode on.
#else
#pragma warning Invalid DEBUG macro.
#endif
__________________ dwk Seek and ye shall find. quaere et invenies. "Simplicity does not precede complexity, but follows it." -- Alan Perlis "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra "The only real mistake is the one from which we learn nothing." -- John Powell Other boards: DaniWeb, TPS Unofficial Wiki FAQ: cpwiki.sf.net My website: http://dwks.theprogrammingsite.com/ Projects: codeform, xuni, atlantis, nort, etc. |
| dwks is offline | |
| | #10 |
| Registered User Join Date: Jan 2007
Posts: 223
| all I get is c:\bla.c(245): warning: ignoring #pragma warning xxx |
| KIBO is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Clarification on compile time error | John_L | C Programming | 2 | 12-04-2007 11:59 AM |
| Military Time Functions | BB18 | C Programming | 6 | 10-10-2004 01:57 PM |
| Getting compile time error due to struct member of type int | m712 | C++ Programming | 0 | 11-29-2002 10:24 PM |
| compile time errors!!!! | devour89 | C++ Programming | 6 | 11-18-2002 05:02 PM |
| Debugging mode selection during compile time | YALINI | C Programming | 1 | 09-03-2001 09:56 AM |