Operating System - Linux
1828621 Members
6621 Online
109983 Solutions
New Discussion

Re: gcc g++ on hpux won't compile (can't find stdint)

 
BenIsCool
Frequent Advisor

gcc g++ on hpux won't compile (can't find stdint)

Hello,

I am trying to get started with some very basic c++ coding on my hpux system.
But I am stuck at square one. I cannot even compile "hello world"
g++ returns an error that says it cannot find stdint.h (which I am not even including so it must be included by iostream)

Any advice?

Thanks
11 REPLIES 11
Dennis Handly
Acclaimed Contributor

Re: gcc g++ on hpux won't compile (can't find stdint)

stdint.h is a C99 header, only available on 11.23. I'm surprised that C++ would be including it. And if g++ needed it, it should include its own copy.
Steven E. Protter
Exalted Contributor

Re: gcc g++ on hpux won't compile (can't find stdint)

Shalom,

Can you say where you got gcc and what version it is? If it is depot software, run swverify against it and see if its even installed correcty.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
BenIsCool
Frequent Advisor

Re: gcc g++ on hpux won't compile (can't find stdint)

I agree that if g++ needed it, it should install its own copy (and be configured to find it). I got gcc from the utah unix porting depot and it is the most recent there.

I found on my own that stdint.h is on the system (and was installed by gcc because it is under the file structure that gcc created)

I created a ln -s to that stdint.h into /usr/include

Now my code compiles fine.

I don't know that this is correct but it worked.

Any thoughts.

Thanks
Dennis Handly
Acclaimed Contributor

Re: gcc g++ on hpux won't compile (can't find stdint)

>I found on my own that stdint.h is on the system (and was installed by gcc because it is under the file structure that gcc created)

The correct solution is to add a -I path to the gcc version.
BenIsCool
Frequent Advisor

Re: gcc g++ on hpux won't compile (can't find stdint)

I'm sorry but I do not know how to do that? (new to g++)
Can you give me some pointers on that?

I have searched for and found a lot of documentation on g++ and c++ coding but nothing on actually using g++ on hpux specifically addressing issues like this.

Thanks
Dennis Handly
Acclaimed Contributor

Re: gcc g++ on hpux won't compile (can't find stdint)

>I'm sorry but I do not know how to do that?

You found the header in some directory. Just add -Ifull-directory-path to your compile line.

The same as any other -I option.
BenIsCool
Frequent Advisor

Re: gcc g++ on hpux won't compile (can't find stdint)

Ahh. (you said -l to gcc version - thought you meant something more profound like configuring the gcc version)

I can use -L (capital) on the gcc 'compile' line and that does work.

Thank you.

Dennis Handly
Acclaimed Contributor

Re: gcc g++ on hpux won't compile (can't find stdint)

>I can use -L on the gcc 'compile' line and that does work.

This is for lib paths. -I is for include paths.
Steve Ellcey
Valued Contributor

Re: gcc g++ on hpux won't compile (can't find stdint)

Could you tell us more about what version of HP-UX (probably HP-PA 11.11?) and what version of GCC you are using? Also, where did you get the GCC compiler, from http://www.hp.com/go/gcc or from the HP Porting and Archive center or from somewhere else? It should be possible to compile hello world on an HP-UX platform with g++ and without any workarounds and if it isn't I am interested in understanding why things aren't working out of the box.
BenIsCool
Frequent Advisor

Re: gcc g++ on hpux won't compile (can't find stdint)

I was a bit confused as to why I could not compile 'hello world' out of box.

This is a fresh install of hp-ux pa 11.11 patched up through the gold pack of early '07.

I am using gcc-4.2.1-hppa-11.11.depot that I got from the Utah HP porting center.

I also tried adding, from the porting center, gettext-0.16.1, libiconv-1.11, make-3.81, and from itrc, PHKL_29243, PHSS_34880, and PHSS_35383.
Steve Ellcey
Valued Contributor

Re: gcc g++ on hpux won't compile (can't find stdint)

When GCC is built it makes (modified) copies of some of the system header files. I think these copies may be out of synch with your own system header files. If you downloaded GCC 4.2.1 from the HP Porting and Archive Center you should have a command on your system called mkheaders, the path is probably:
/usr/local/libexec/gcc/hppa2.0w-hp-hpux11.11/4.2.1/install-tools/mkheaders

If you have a different GCC version or are on a different OS the path may be slightly different. Try running this mkheaders command, it will reexamine the system headers and update the GCC specific versions of those headers to match what is on your system. You will probably need to be root to do this and it will modify your GCC header files so you might want to back them up or if you still have the depot you could restore them using that if something got messed up. mkheaders should not change any files except ones that are part of the GCC installation.