Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Easy one for you, where is hpux defined ?

Status
Not open for further replies.

OhNoNotAgain

Programmer
May 21, 2003
6
AU
Hello all,

I have developed a C program that needs to run on a HP-UX and Sun Solaris. Depending on the machine I set certain variable contents. To do this I use ifdef to check the machine type, on Sun it works a treat, on HP no joy. This is what I have...

#ifdef hpux
char cBox[] = "I am a HP";
#endif

#ifdef sun
char cBox[] = "I am a SUN";
#endif

Any idea how hpux is set and where it is set ?

I am using cc -g +DAportable as my compile options on the HP box as it needs to run on both 32 and 64 bit HP's.

Thanks
 
You can get a return of HP-UX from the command uname. Does that help?
 
It isn't set in any of the include files that come with HP/UX. However, you can define it with the -D option on the cc command line:

cc -g -o [out file] [source file(s)] +DAportable -Dhpux


Hope that helps,

Jason Deckard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top