Other HI-TECH Compilers & Products >> 8051 Legacy Compiler

Pages: 1
Kris K.
stranger


Reged: Jan 30 2008
Posts: 2
Command line preprocessor definition (-D) with quoted strings
      #33132 - Wed Jan 30 2008 11:49 AM

We have an existing makefile used with previous versions under Linux. Right now I am using the C51 v9.01 compiler under Windows XP. My problem is in using the -Dmacro=text command line option.
Previously, we used the option as
Code:
-Dmacro=\"text\" 


which gave us something equivalent to
Code:
#define macro "text"


in the final code. However, now, using the same command line option, the result is equivalent to
Code:
#define macro text



Is it possible to escape quotation marks to get to the previous behavior?


Post Extras: Print Post   Remind Me!   Notify Moderator  
luckyAdministrator
HI-TECH team member
*****

Reged: Oct 06 2003
Posts: 1072
Loc: Brisbane, Australia
Re: Command line preprocessor definition (-D) with quoted strings [Re: Kris K.]
      #33232 - Wed Jan 30 2008 06:39 PM

Quote:

Is it possible to escape quotation marks to get to the previous behavior?




It is possible - I have done this before, however I'm not in front of a windows machine at the moment. From memory I think you use single quotes around the double quotes. Backslash escaping is not needed. The windows command line is not great. An alternative is to install the cygwin package and then your existing makefiles etc.. will still work unchanged (or keep using the linux version of the compiler).

--------------------
Matt Luckman
HI-TECH Software


Post Extras: Print Post   Remind Me!   Notify Moderator  
Kris K.
stranger


Reged: Jan 30 2008
Posts: 2
Re: Command line preprocessor definition (-D) with quoted strings [Re: lucky]
      #33242 - Wed Jan 30 2008 06:47 PM

Quote:

From memory I think you use single quotes around the double quotes. Backslash escaping is not needed.




Strangely enough, using single quotes
Code:
-Dmacro='"text"'


gives the equivalent of
Code:
#define macro 'text'



So it removes the double quotes completely.

Any further ideas would be greatly appreciated.
I may switch back to the Linux version of the compiler, but I'd like to be able to compile this under Windows.
Thanks.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Dan HenryModerator
Guru
****

Reged: Oct 16 2003
Posts: 3445
Loc: Boulder, Colorado U.S.A.
Re: Command line preprocessor definition (-D) with quoted strings [Re: Kris K.]
      #33252 - Wed Jan 30 2008 07:43 PM

Quote:

I'd like to be able to compile this under Windows.



As lucky mentioned cygwin is quite helpful in this regard.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 1 anonymous users are browsing this forum.

Moderator:  ndouglas, jtemples, Dan Henry, Andrew L, mikerj, dave g, meisty, josh stevo 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is enabled
      UBBCode is enabled

Rating:
Topic views: 2290

Rate this topic

Jump to

Contact Us | Privacy statement HI-TECH Software

Powered by UBB.threads™ 6.5.5