Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

cc ' -DXXX=long long'

807578Jul 28 2010 — edited Aug 5 2010
So I need to pass a -D macro containing a space to my Sun Studio 12 C compiler running on Solaris 10 x86 using a korn shell.

I run:
cc -Xc ' -DXXX=long long' define.c

And all works well.

But I want to put the compiler options in an environmental variable so I try:
export ZZZ="-Xc ' -DXXX=long long'"
cc $ZZZ define.c

And it fails. XXX is not set. In fact the entire -D string ends up getting passed through to the linker phase.

I can do an alias:
alias cc="/opt/sunstudio12.1/bin/cc '-DXXX=long long'"
cc -Xc define.c

Which works. But I really want to use an env variable if possible. I tried different methods of escaping the string but no luck.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 2 2010
Added on Jul 28 2010
2 comments
731 views