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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 PreProcessor issue
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

datrix

11 Posts

Posted - 07/11/2009 :  11:23:52 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

datrix

11 Posts

Posted - 07/11/2009 :  11:36:45 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Posted too fast.
The solution is

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

greets
datrix

Edited by - datrix on 07/11/2009 11:37:04 AM
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000