The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 PreProcessor issue

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
datrix Posted - 07/11/2009 : 11:23:52 AM
Origin Ver. 7.5 / SR0
WinXP SP2
-------------

Hello,

the Origin Programming Help says there are some Preprozessor directives like #define, #if, #elif, #endif ...

I want to build a TRACE-System for better debugging, that compile only if a the PreProcessor-Variable is set to 1.
Here is a short example:


#define TRACE 0

void importmultiwas() {

   int iNumSelFiles;
   StringArray saFiletypes, saFilePaths; 
   saFiletypes.SetSize(1);
   saFiletypes[0]="[OSA-ASCII-File (*.WAS)] *.WAS";
   iNumSelFiles = GetMultiOpenBox( saFilePaths, saFiletypes );

/*--BEGIN-TRACE--------------*/
        #if TRACE 
	out_int("Num_Of_Files_selected = ", iNumSelFiles);
	out_str(saFiletypes[0]);
	for (int i=0; i<iNumSelFiles; i++) {
	out_str(saFilePaths[i];)
        }
	#endif
/*--END-TRACE----------------*/		

}


This example compiles without any error and it shouldn´t compile and execute the part marked as BEGIN/END-TRACE until TRACE is set to 1, but it does. I cannot see any mistake
Thank you,
datrix
1   L A T E S T    R E P L I E S    (Newest First)
datrix Posted - 07/11/2009 : 11:36:45 AM
Posted too fast.
The solution is

"#if TRACE==1" instead of "#if TRACE".

greets
datrix

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000