Author | Topic: Compiler options question #ifdef #ifndef and /dConstant | |
---|---|---|
Marcelo Ramos | Compiler options question #ifdef #ifndef and /dConstant on Tue, 29 Mar 2005 15:51:02 -0500 Hi There, I'm not sure I'm doing this right, so thats why I'm posting this question: When I define a symbolic constant on my compiler; COMPILE_FLAGS = /dMYCNST and I try to use this constant in my code: #ifndef MYCNST Alert("No constant") #else Alert("Yes constant") #endif The compiler acts like the constant MYCNST is never there.. Am I putting the wrong flag in the wrong place? Here is a piece of the real code XPJ file, if that helps.. Thanks a lot guys! []s Marcelo ------------------------------------------------------------------------- [PROJECT] COMPILE = xpp DEBUG = yes GUI = Yes . . . [PROJECT.XPJ] xCan.exe xCanLite.exe //********************************************************* //*********************** Cancun Full Version ****************** //********************************************************* [xCan.EXE] COMPILE_FLAGS = /q /dCAN can.prg secur_li.prg canlib.prg tab_help.prg view_lib.prg . . . //********************************************************* //*********************** Cancun Lite (For brokers) ************* //********************************************************* [xCanLite.Exe] COMPILE_FLAGS = /q /dCAN2 can.prg secur_li.prg canlib.prg tab_help.prg view_lib.prg . . . ------------------------------------------------------------- | |
Jose Luis Otermin | Re: Compiler options question #ifdef #ifndef and /dConstant on Wed, 30 Mar 2005 00:38:22 -0300 Hi Marcelo, Try this: [PROJECT] COMPILE = xpp /dMYCNST DEBUG = yes [...] HTH -- Best regards, Jos Luis Otermin oterminATciudad.com.ar Enjoy the growing Xbase++ repository http://ar.groups.yahoo.com/group/XFreeProject/join "Marcelo Ramos" <mramos@caisoftdesign.ca> escribi en el mensaje news:x0oLnCKNFHA.6152@S15147418... > Hi There, > > I'm not sure I'm doing this right, so thats why I'm posting this > question: > When I define a symbolic constant on my compiler; > COMPILE_FLAGS = /dMYCNST > and I try to use this constant in my code: > #ifndef MYCNST > Alert("No constant") > #else > Alert("Yes constant") > #endif > The compiler acts like the constant MYCNST is never there.. > > Am I putting the wrong flag in the wrong place? > Here is a piece of the real code XPJ file, if that helps.. > > Thanks a lot guys! > []s > Marcelo > > > ------------------------------------------------------------------------- > > [PROJECT] > COMPILE = xpp > DEBUG = yes > GUI = Yes > . > . > . > > [PROJECT.XPJ] > xCan.exe > xCanLite.exe > > //********************************************************* > //*********************** Cancun Full Version ****************** > //********************************************************* > [xCan.EXE] > COMPILE_FLAGS = /q /dCAN > can.prg > secur_li.prg > canlib.prg > tab_help.prg > view_lib.prg > . > . > . > > > //********************************************************* > //*********************** Cancun Lite (For brokers) ************* > //********************************************************* > [xCanLite.Exe] > COMPILE_FLAGS = /q /dCAN2 > can.prg > secur_li.prg > canlib.prg > tab_help.prg > view_lib.prg > . > . > . > > ------------------------------------------------------------- > > | |
Phil Ide | Re: Compiler options question #ifdef #ifndef and /dConstant on Wed, 30 Mar 2005 13:22:14 +0100 Marcelo, > I'm not sure I'm doing this right, so thats why I'm posting this > question: > When I define a symbolic constant on my compiler; > COMPILE_FLAGS = /dMYCNST > and I try to use this constant in my code: > #ifndef MYCNST > Alert("No constant") > #else > Alert("Yes constant") > #endif > The compiler acts like the constant MYCNST is never there.. > > Am I putting the wrong flag in the wrong place? > Here is a piece of the real code XPJ file, if that helps.. I'm not sure if it is related, but there is a bug in the compiler related to #if, #ifdef and #ifndef. Take this as an example: #define MY_VALUE 10001 #if MY_VALUE < 10000 #stdout Less than 10k #else #stdout Greater than 10k #endif Regards, Phil Ide *************************************** * Xbase++ FAQ, Libraries and Sources: * * goto: http://www.idep.org.uk/xbase * *************************************** Be careful playing beneath the Anvil tree. | |
Shum [Ming Yik] | Re: Compiler options question #ifdef #ifndef and /dConstant on Thu, 31 Mar 2005 00:00:58 +0800 Hello, I never try #ifndef, But #ifdef #else #endif work for me may try: #ifdef MYCNST Alert("Yes constant") #else Alert("No constant") #endif Shum www.mingyik.com "Marcelo Ramos" <mramos@caisoftdesign.ca> glsD:x0oLnCKNFHA.6152@S15147418... > Hi There, > > I'm not sure I'm doing this right, so thats why I'm posting this > question: > When I define a symbolic constant on my compiler; > COMPILE_FLAGS = /dMYCNST > and I try to use this constant in my code: > #ifndef MYCNST > Alert("No constant") > #else > Alert("Yes constant") > #endif > The compiler acts like the constant MYCNST is never there.. > > Am I putting the wrong flag in the wrong place? > Here is a piece of the real code XPJ file, if that helps.. > > Thanks a lot guys! > []s > Marcelo > > > ------------------------------------------------------------------------- > > [PROJECT] > COMPILE = xpp > DEBUG = yes > GUI = Yes > . > . > . > > [PROJECT.XPJ] > xCan.exe > xCanLite.exe > > //********************************************************* > //*********************** Cancun Full Version ****************** > //********************************************************* > [xCan.EXE] > COMPILE_FLAGS = /q /dCAN > can.prg > secur_li.prg > canlib.prg > tab_help.prg > view_lib.prg > . > . > . > > > //********************************************************* > //*********************** Cancun Lite (For brokers) ************* > //********************************************************* > [xCanLite.Exe] > COMPILE_FLAGS = /q /dCAN2 > can.prg > secur_li.prg > canlib.prg > tab_help.prg > view_lib.prg > . > . > . > > ------------------------------------------------------------- > > | |
Marcelo Ramos | Re: Compiler options question #ifdef #ifndef and /dConstant on Wed, 30 Mar 2005 11:35:34 -0500 Alright guys, ill try the tips! thanks a lot all of u! Phil, about you comment, is there a workaround for this bug? "Marcelo Ramos" <mramos@caisoftdesign.ca> wrote in message news:x0oLnCKNFHA.6152@S15147418... > Hi There, > > I'm not sure I'm doing this right, so thats why I'm posting this > question: > When I define a symbolic constant on my compiler; > COMPILE_FLAGS = /dMYCNST > and I try to use this constant in my code: > #ifndef MYCNST > Alert("No constant") > #else > Alert("Yes constant") > #endif > The compiler acts like the constant MYCNST is never there.. > > Am I putting the wrong flag in the wrong place? > Here is a piece of the real code XPJ file, if that helps.. > > Thanks a lot guys! > []s > Marcelo > > > ------------------------------------------------------------------------- > > [PROJECT] > COMPILE = xpp > DEBUG = yes > GUI = Yes > . > . > . > > [PROJECT.XPJ] > xCan.exe > xCanLite.exe > > //********************************************************* > //*********************** Cancun Full Version ****************** > //********************************************************* > [xCan.EXE] > COMPILE_FLAGS = /q /dCAN > can.prg > secur_li.prg > canlib.prg > tab_help.prg > view_lib.prg > . > . > . > > > //********************************************************* > //*********************** Cancun Lite (For brokers) ************* > //********************************************************* > [xCanLite.Exe] > COMPILE_FLAGS = /q /dCAN2 > can.prg > secur_li.prg > canlib.prg > tab_help.prg > view_lib.prg > . > . > . > > ------------------------------------------------------------- > > | |
James Loughner | Re: Compiler options question #ifdef #ifndef and /dConstant on Wed, 30 Mar 2005 13:08:14 -0500 I use #ifdef and #ifndef all the time in my code setting the constant in the project file. Are you sure you are triggering a recompile when you change the constant?? Simply changing the constant in the project will not trigger a recompile of the objects!!. Generally force a complete rebuild when I change the constant in the project file. Jim Marcelo Ramos wrote: > Alright guys, ill try the tips! thanks a lot all of u! > > Phil, about you comment, is there a workaround for this bug? > > "Marcelo Ramos" <mramos@caisoftdesign.ca> wrote in message > news:x0oLnCKNFHA.6152@S15147418... > >>Hi There, >> >> I'm not sure I'm doing this right, so thats why I'm posting this >>question: >> When I define a symbolic constant on my compiler; >> COMPILE_FLAGS = /dMYCNST >> and I try to use this constant in my code: >> #ifndef MYCNST >> Alert("No constant") >> #else >> Alert("Yes constant") >> #endif >> The compiler acts like the constant MYCNST is never there.. >> >> Am I putting the wrong flag in the wrong place? >> Here is a piece of the real code XPJ file, if that helps.. >> >>Thanks a lot guys! >>[]s >>Marcelo >> >> >>------------------------------------------------------------------------- >> >>[PROJECT] >> COMPILE = xpp >> DEBUG = yes >> GUI = Yes >> . >> . >> . >> >>[PROJECT.XPJ] >> xCan.exe >> xCanLite.exe >> >>//********************************************************* >>//*********************** Cancun Full Version ****************** >>//********************************************************* >>[xCan.EXE] >> COMPILE_FLAGS = /q /dCAN >>can.prg >>secur_li.prg >>canlib.prg >>tab_help.prg >>view_lib.prg >>. >>. >>. >> >> >>//********************************************************* >>//*********************** Cancun Lite (For brokers) ************* >>//********************************************************* >>[xCanLite.Exe] >> COMPILE_FLAGS = /q /dCAN2 >>can.prg >>secur_li.prg >>canlib.prg >>tab_help.prg >>view_lib.prg >>. >>. >>. >> >>------------------------------------------------------------- >> >> > > > | |
Marcelo Ramos | Re: Compiler options question #ifdef #ifndef and /dConstant on Wed, 30 Mar 2005 15:50:10 -0500 Hey Jim, Positive, I am doing a recompile w/ the option /ALL (pbuild /all).. thanks! Marcelo "James Loughner" <jwrl@charter.net> wrote in message news:WCpUTNVNFHA.3104@S15147418... > I use #ifdef and #ifndef all the time in my code setting the constant in > the project file. Are you sure you are triggering a recompile when you > change the constant?? Simply changing the constant in the project will > not trigger a recompile of the objects!!. Generally force a complete > rebuild when I change the constant in the project file. > > Jim > > > Marcelo Ramos wrote: > > Alright guys, ill try the tips! thanks a lot all of u! > > > > Phil, about you comment, is there a workaround for this bug? > > > > "Marcelo Ramos" <mramos@caisoftdesign.ca> wrote in message > > news:x0oLnCKNFHA.6152@S15147418... > > > >>Hi There, > >> > >> I'm not sure I'm doing this right, so thats why I'm posting this > >>question: > >> When I define a symbolic constant on my compiler; > >> COMPILE_FLAGS = /dMYCNST > >> and I try to use this constant in my code: > >> #ifndef MYCNST > >> Alert("No constant") > >> #else > >> Alert("Yes constant") > >> #endif > >> The compiler acts like the constant MYCNST is never there.. > >> > >> Am I putting the wrong flag in the wrong place? > >> Here is a piece of the real code XPJ file, if that helps.. > >> > >>Thanks a lot guys! > >>[]s > >>Marcelo > >> > >> > >>------------------------------------------------------------------------- > >> > >>[PROJECT] > >> COMPILE = xpp > >> DEBUG = yes > >> GUI = Yes > >> . > >> . > >> . > >> > >>[PROJECT.XPJ] > >> xCan.exe > >> xCanLite.exe > >> > >>//********************************************************* > >>//*********************** Cancun Full Version ****************** > >>//********************************************************* > >>[xCan.EXE] > >> COMPILE_FLAGS = /q /dCAN > >>can.prg > >>secur_li.prg > >>canlib.prg > >>tab_help.prg > >>view_lib.prg > >>. > >>. > >>. > >> > >> > >>//********************************************************* > >>//*********************** Cancun Lite (For brokers) ************* > >>//********************************************************* > >>[xCanLite.Exe] > >> COMPILE_FLAGS = /q /dCAN2 > >>can.prg > >>secur_li.prg > >>canlib.prg > >>tab_help.prg > >>view_lib.prg > >>. > >>. > >>. > >> > >>------------------------------------------------------------- > >> > >> > > > > > > | |
Phil Ide | Re: Compiler options question #ifdef #ifndef and /dConstant on Thu, 31 Mar 2005 11:35:45 +0100 Marcelo, > Phil, about you comment, is there a workaround for this bug? Only to do the same thing in a different way. I had this: #define __ILIB_INONE__ 0 #define __ILIB_ASINET__ 1 #define __ILIB_XB2NET__ 2 #define __ILIB_ILIB__ __ILIB_INONE__ #if __ILIB_ILIB__ == __ILIB_ASINET__ #include "asinetc.ch" #elseif __ILIB_ILIB__ == __ILIB_XB2NET__ #include "xb2net.ch" #endif I had to change this to: #define __ILIB_INOLIB__ No sockets library //#define __ILIB_ASINET__ ASINET library //#define __ILIB_XB2NET__ Xb2NET library #ifdef __ILIB_ASINET__ #include "asinetc.ch" #endif #ifdef __ILIB_XB2NET__ #include "xb2net.ch" #pragma Library("XB2NET.LIB") #endif #ifdef __ILIB_INOLIB__ #define AF_INET 0 #define SOCK_STREAM 0 #endif Regards, Phil Ide *************************************** * Xbase++ FAQ, Libraries and Sources: * * goto: http://www.idep.org.uk/xbase * *************************************** Rain Rain Go away! Come Again Some Other Day! |