problem including stdlib.h

When I try to include stdlib.h in my c++ program and compile it using
g++, it returns the following error message:

g++ test5.cpp
In file included from test5.cpp:1:
/usr/include/stdlib.h:239: abort' is already declared in this scope /usr/include/stdlib.h:239: abs’ is already declared in this scope
/usr/include/stdlib.h:240: exit' is already declared in this scope /usr/include/stdlib.h:240: labs’ is already declared in this scope

Any idea why???

Don’t do that.

I’ve had the same problem. I wrapped the include in #ifdef’s

#ifndef __cplusplus
#include <stdlib.h>
#endif

But i do believe it is a bug in stdlib.h.


Bill Caroselli – 1(530) 510-7292
Q-TPS Consulting
QTPS@EarthLink.net

“Igor Sapozhnikov” <i_sapozh@cs.concordia.ca> wrote in message
news:3BD84DF0.95475178@cs.concordia.ca

When I try to include stdlib.h in my c++ program and compile it using
g++, it returns the following error message:

g++ test5.cpp
In file included from test5.cpp:1:
/usr/include/stdlib.h:239: abort' is already declared in this scope /usr/include/stdlib.h:239: abs’ is already declared in this scope
/usr/include/stdlib.h:240: exit' is already declared in this scope /usr/include/stdlib.h:240: labs’ is already declared in this scope

Any idea why???

Well, this doesn’t really solve the problem. If you don’t include the
stdlib.h, you can’t use the functions it provides, can you?

It appears that some C++ header is including/defineing those names. I never
took the time to track it down. But removing it from certain C++ programs
sovles the problem. I too, would love to knopw why this happens and to have
it fixed.


Bill Caroselli – 1(530) 510-7292
Q-TPS Consulting
QTPS@EarthLink.net


“Igor Sapozhnikov” <i_sapozh@cs.concordia.ca> wrote in message
news:3BDAEDB3.7371DA4E@cs.concordia.ca

Well, this doesn’t really solve the problem. If you don’t include the
stdlib.h, you can’t use the functions it provides, can you?

“Bill Caroselli (Q-TPS)” <qtps@earthlink.net> wrote:

It appears that some C++ header is including/defineing those names. I never
took the time to track it down. But removing it from certain C++ programs
sovles the problem. I too, would love to knopw why this happens and to have
it fixed.

Look at the /etc/qcc/gcc* files:

cpp_opt=-nostdinc -nostdinc++ -D__cplusplus
-D__QNX__ -D__QNXNTO__
“-D__GNUC__=2” “-D__GNUC_MINOR__=95” “-D__GNUG__=2”
-D__unix__ -D__unix -D__ELF__
-D__X86__ -D__i386__
-D__LITTLEENDIAN__
-Asystem(unix) -Asystem(nto) -Asystem(qnx) -Asystem(qnxnto)

cpp_stdinc=-idirafter “$(QNX_TARGET)/usr/include”

cpp_stdinc++=

Try to call g++ with these flags. It seems that dinkum library
requires some defines :slight_smile:

The QCC frontend calls g++ with these (and more (look /etc/qcc/QCC*))
addictional flags/defines.

Let me know if this solves the problem


Bill Caroselli – 1(530) 510-7292
Q-TPS Consulting
QTPS@EarthLink.net



“Igor Sapozhnikov” <> i_sapozh@cs.concordia.ca> > wrote in message
news:> 3BDAEDB3.7371DA4E@cs.concordia.ca> …
Well, this doesn’t really solve the problem. If you don’t include the
stdlib.h, you can’t use the functions it provides, can you?


Wave++

It is a bug, and you can easily fix it.
See Colin’s post in comp.os.qnx back in July for details.

http://groups.google.com/groups?q=specs+colin+group:comp.os.qnx&scoring=r&rnum=1&selm=9j6suf%245kf%241%40nntp.qnx.com

Frank

“Bill Caroselli (Q-TPS)” <qtps@earthlink.net> wrote:

It appears that some C++ header is including/defineing those names. I never
took the time to track it down. But removing it from certain C++ programs
sovles the problem. I too, would love to knopw why this happens and to have
it fixed.


Bill Caroselli – 1(530) 510-7292
Q-TPS Consulting
QTPS@EarthLink.net



“Igor Sapozhnikov” <> i_sapozh@cs.concordia.ca> > wrote in message
news:> 3BDAEDB3.7371DA4E@cs.concordia.ca> …
Well, this doesn’t really solve the problem. If you don’t include the
stdlib.h, you can’t use the functions it provides, can you?

My public key can be found at
http://mama.indstate.edu/users/liug/key.txt