You can do it on the command line with -D_TEST .
Up vote 2 down vote favorite 1 share g+ share fb share tw.
I'm programming to a microprocessor (Coldfire) and I don't have access every day to the microprocessor trainer so I want to be able to execute some of my code on the computer. So I'm trying to skip a part of my code when executing on the computer by defining _TEST_. It doesn't work.
It tries to compile the asm code and dies whining about not knowing the registers names (they're defined alright compiling against the Coldfire, not my Intel Core Duo). Any ideas why it's not working? Or maybe an alternative way to run the code on the pc without commenting it out?.
Here's sample code from my project: inline void ct_sistem_exit(int status) { #ifdef _TEST_ exit(status); #else asm volatile( "moveb #0,%%d1\n\t" "movel #0, %%d0\n\t" "trap #15\n\t" : : : "d0", "d1" ); #endif /* _TEST_ */ } If it helps: using gcc3 with cygwin on Netbeans 6.8 And the way I'm defining _TEST_: #define _TEST_ #include "mycode. C" int main(int argc, char** argv) { ct_sistem_exit(0); } c preprocessor link|improve this question edited May 5 '10 at 23:25 asked May 5 '10 at 22:07demula606.
It seems like it should work if that symbol gets defined correctly. You could try putting "#define 'TEST' 1" right before this function to make sure it is working. You might also try a different name in case 'TEST' is used for something else.
– bde May 5 '10 at 22:12 I tried defining TEST right before the function as you said but it throws funny errors on my code. I'll add to the question how I defined TEST – demula May 5 '10 at 23:22.
You can do it on the command line with -D_TEST_. I can compile your code when I define it.
You're right! I did not. I was compiling another file that was importing this code and though I defined TEST before including it, it wasn't defined when processing the code (I don't know why...).
Besides the command line option I just discovered that Netbeans lets you define before processing: Run>Set Project Configuration>Customize...>C Compiler>Preprocessor Definitions Thanks a lot! – demula May 5 '10 at 23:07.
You normally shouldn't use symbol names that start with the underscore. Those are reserved for use by the compiler and standard libraries. It is likely that there is already a TEST defined somewhere.
It should be easy enough to check for, though. You may want to try using #warning to tell you when you are building for the test machine, which will help you test that the preprocessor is doing what you expect.
TEST wasn't used by anyone although I'll keep in mind the underscores. #warning advice added! Thanks a lot for the tips – demula May 5 '10 at 23:34.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.