473,408 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

cstdlib and stdlib.h problem

Hi,

in a cpp file we are including <cstdliband indirectly including
<stdlib.h>. But the definition for "strtoll" is not appearing in
the .ii file generated using the -E option to gcc.

snippet of .ii file

=========================================
# 307 "/vobs/publish_linux_vob/publish_linux/include/pin_type.h" 2
# 358 "/vobs/publish_linux_vob/publish_linux/include/pin_type.h"
# 1 "/usr/lib/gcc/x86_64-redhat-linux/3.4.6/include/stddef.h" 1 3 4
# 359 "/vobs/publish_linux_vob/publish_linux/include/pin_type.h" 2
# 371 "/vobs/publish_linux_vob/publish_linux/include/pin_type.h"
# 1 "/vobs/publish_linux_vob/publish_linux/include/pin_os_string.h" 1
# 14 "/vobs/publish_linux_vob/publish_linux/include/pin_os_string.h"
# 1 "/usr/include/stdlib.h" 1 3 4
# 33 "/usr/include/stdlib.h" 3 4
# 1 "/usr/lib/gcc/x86_64-redhat-linux/3.4.6/include/stddef.h" 1 3 4
# 34 "/usr/include/stdlib.h" 2 3 4

extern "C" {


# 1 "/usr/include/bits/waitflags.h" 1 3 4
# 43 "/usr/include/stdlib.h" 2 3 4
# 1 "/usr/include/bits/waitstatus.h" 1 3 4
# 65 "/usr/include/bits/waitstatus.h" 3
:
:
:
:
:
# 140 "/usr/include/stdlib.h" 3 4
extern size_t __ctype_get_mb_cur_max (void) throw ();


extern double atof (__const char *__nptr)
throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__
(1)));

extern int atoi (__const char *__nptr)
throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__
(1)));

extern long int atol (__const char *__nptr)
throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__
(1)));

__extension__ extern long long int atoll (__const char *__nptr)
throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__
(1)));

extern double strtod (__const char *__restrict __nptr,
char **__restrict __endptr) throw () __attribute__
((__nonnull__ (1)));

extern float strtof (__const char *__restrict __nptr,
char **__restrict __endptr) throw () __attribute__
((__nonnull__ (1)));

extern long double strtold (__const char *__restrict __nptr,
char **__restrict __endptr)
throw () __attribute__ ((__nonnull__ (1)));
extern long int strtol (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
throw () __attribute__ ((__nonnull__ (1)));

extern unsigned long int strtoul (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
throw () __attribute__ ((__nonnull__ (1)));


__extension__
extern long long int strtoq (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
throw () __attribute__ ((__nonnull__ (1)));

__extension__
extern unsigned long long int strtouq (__const char *__restrict
__nptr,
char **__restrict __endptr, int __base)
throw () __attribute__ ((__nonnull__ (1)));

__extension__
extern long long int strtoq (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
throw () __attribute__ ((__nonnull__ (1)));

__extension__
extern unsigned long long int strtoull (__const char *__restrict
__nptr,
char **__restrict __endptr, int __base)
throw () __attribute__ ((__nonnull__ (1)));

# 239 "/usr/include/stdlib.h" 3 4
extern long int strtol_l (__const char *__restrict __nptr,
char **__restrict __endptr, int __base,
__locale_t __loc) throw () __attribute__ ((__nonnull__ (1, 4)));

extern unsigned long int strtoul_l (__const char *__restrict __nptr,
char **__restrict __endptr,
int __base, __locale_t __loc)
throw () __attribute__ ((__nonnull__ (1, 4)));

__extension__
extern long long int strtoll_l (__const char *__restrict __nptr,
char **__restrict __endptr, int __base,
__locale_t __loc)
throw () __attribute__ ((__nonnull__ (1, 4)));

__extension__
extern unsigned long long int strtoull_l (__const char *__restrict
__nptr,
char **__restrict __endptr,
int __base, __locale_t __loc)
:
:
:
:
==============================================
Command used to generate the .ii file

gcc -c -I/vobs/rw_rls_unix_vob/rw_rls_unix/ed9/linux_gcc346_32 -I/vobs/
rw_rls_unix_vob/rw_rls_unix/ed9/linux_gcc346_32/include -I../../
include -I/vobs/publish_linux_vob/publish_linux/include -I. -I./
include -I../include -DOS_VER=linux_2.6.9-42.0.0.0.1.ELsmp -
DPIN_USE_ANSI_HDRS -D_REENTRANT -D__unix -D__linux -Dlinux -D__linux__
-DLITTLE_ENDIAN -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -
D_GLIBC_HAVE_LONG_LONG -D__USE_MISC -DLINUX -Dx86 -Dx86_64 -pthread -
Wall -Wno-unused -fPIC -Wno-ctor-dtor-privacy -Wno-reorder -
DINC_TEMPL_DEFS=1 -fpermissive -m32 -g -D_PIN_DEBUG -D_DEBUG -DPUBLIC=
-D_PCM_OPS_H -DTRACE -DRWDEBUG=1 -D_RWSTD_MINIMUM_NEW_CAPACITY=4 -
D_RWSTD_NEW_CAPACITY_RATIO=1.1 -D_RWSTD_MINIMUM_STRING_CAPACITY=16 -
DRW_MULTI_THREAD -DRWSTD_MULTI_THREAD -DRWTRACE=0 -
DRW_USER_TRACE_LEVEL=0 -D_RWCONFIG_15d -DRWLIBVERSION="15d" -
DRW_THR_OS_VERSION_LINUX=0x02609 -
DRW_THR_COMPILER_VERSION_GCC=0x00030404 -D__USE_ISOC99 -E -o
ProcTimeCounteR1.II ProcTimeCounter.cpp

In stdlib.h I can see the code like
=============================================

#if defined __USE_ISOC99 || (defined __GLIBC_HAVE_LONG_LONG && defined
__USE_MISC)
__BEGIN_NAMESPACE_C99
/* Convert a string to a quadword integer. */
__extension__
extern long long int strtoll (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
__THROW __nonnull ((1));
=============================================
So i am using -D__USE_ISOC99 in my compile command. Still its not
working... Please let me know what could be the problem.

PS: If I include the <stdlib.hdirectly into the cpp source file its
working. But I am not sure why it is not including the definition from
the indirectly included <stdlib.h>

May 30 '07 #1
4 6265
On 30 Maj, 07:42, Subra <mailursu...@gmail.comwrote:
Hi,

in a cpp file we are including <cstdliband indirectly including
<stdlib.h>. But the definition for "strtoll" is not appearing in
the .ii file generated using the -E option to gcc.
[snip]
In stdlib.h I can see the code like
=============================================

#if defined __USE_ISOC99 || (defined __GLIBC_HAVE_LONG_LONG && defined
__USE_MISC)
__BEGIN_NAMESPACE_C99
/* Convert a string to a quadword integer. */
__extension__
extern long long int strtoll (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
__THROW __nonnull ((1));
=============================================
So i am using -D__USE_ISOC99 in my compile command. Still its not
working... Please let me know what could be the problem.
The C library part of C++ is not updated to C99 standards yet. As tho
why using -D__USE_ISOC99 does not work I don't know, it's an
implementation detail, but there might be something in cstdlib that
disables support for C99 features to make sure that it's fully C++
compatible. You'll have to ask in a forum for your implementation for
more details.

--
Erik Wikström

May 30 '07 #2
The C library part of C++ is not updated to C99 standards yet. As tho
why using -D__USE_ISOC99 does not work I don't know, it's an
I tried writing test.cpp
#include<test.hpp>
int main()
{
return 0;
}

and test.hpp with
#include<stdlib.h>

this works fine with
gcc -c -I/vobs/rw_rls_unix_vob/rw_rls_unix/ed9/linux_gcc346_32 -I/vobs/
rw_rls_unix_vob/rw_rls_unix/ed9/linux_gcc346_32/include -I../include -
I/vobs/publish_linux_vob/publish_linux/include -I. -I./include -I../
include -DOS_VER=linux_2.6.9-42.0.0.0.1.ELsmp -DPIN_USE_ANSI_HDRS -
D_REENTRANT -D__unix -D__linux -Dlinux -D__linux__ -DLITTLE_ENDIAN -
D_XOPEN_SOURCE=500 -D_GNU_SOURCE -DLINUX -Dx86 -Dx86_64 -pthread -Wall
-Wno-unused -fPIC -Wno-ctor-dtor-privacy -Wno-reorder -
DINC_TEMPL_DEFS=1 -fpermissive -m32 -g -D_PIN_DEBUG -D_DEBUG -DPUBLIC=
-D_PCM_OPS_H -DTRACE -DRWDEBUG=1 -D_RWSTD_MINIMUM_NEW_CAPACITY=4 -
D_RWSTD_NEW_CAPACITY_RATIO=1.1 -D_RWSTD_MINIMUM_STRING_CAPACITY=16 -
DRW_MULTI_THREAD -DRWSTD_MULTI_THREAD -DRWTRACE=0 -
DRW_USER_TRACE_LEVEL=0 -D_RWCONFIG_15d -DRWLIBVERSION="15d" -
DRW_THR_OS_VERSION_LINUX=0x02609 -
DRW_THR_COMPILER_VERSION_GCC=0x00030404 -DSHLIB_PREFIX="lib" -
DSHLIB_EXT="_dbg.so" -DSCR_INTERNAL -I../../../tools_vob/tools/linux/
flex/include test.cpp
What might be the problem with my actual project ?

May 30 '07 #3
On May 30, 9:10 am, Subra <mailursu...@gmail.comwrote:
The C library part of C++ is not updated to C99 standards yet. As tho
why using -D__USE_ISOC99 does not work I don't know, it's an
I tried writing test.cpp
#include<test.hpp>
int main()
{
return 0;

}
and test.hpp with
#include<stdlib.h>
this works fine with
gcc -c -I/vobs/rw_rls_unix_vob/rw_rls_unix/ed9/linux_gcc346_32 -I/vobs/
rw_rls_unix_vob/rw_rls_unix/ed9/linux_gcc346_32/include -I../include -
I/vobs/publish_linux_vob/publish_linux/include -I. -I./include -I../
include -DOS_VER=linux_2.6.9-42.0.0.0.1.ELsmp -DPIN_USE_ANSI_HDRS -
D_REENTRANT -D__unix -D__linux -Dlinux -D__linux__ -DLITTLE_ENDIAN -
D_XOPEN_SOURCE=500 -D_GNU_SOURCE -DLINUX -Dx86 -Dx86_64 -pthread -Wall
-Wno-unused -fPIC -Wno-ctor-dtor-privacy -Wno-reorder -
DINC_TEMPL_DEFS=1 -fpermissive -m32 -g -D_PIN_DEBUG -D_DEBUG -DPUBLIC=
-D_PCM_OPS_H -DTRACE -DRWDEBUG=1 -D_RWSTD_MINIMUM_NEW_CAPACITY=4 -
D_RWSTD_NEW_CAPACITY_RATIO=1.1 -D_RWSTD_MINIMUM_STRING_CAPACITY=16 -
DRW_MULTI_THREAD -DRWSTD_MULTI_THREAD -DRWTRACE=0 -
DRW_USER_TRACE_LEVEL=0 -D_RWCONFIG_15d -DRWLIBVERSION="15d" -
DRW_THR_OS_VERSION_LINUX=0x02609 -
DRW_THR_COMPILER_VERSION_GCC=0x00030404 -DSHLIB_PREFIX="lib" -
DSHLIB_EXT="_dbg.so" -DSCR_INTERNAL -I../../../tools_vob/tools/linux/
flex/include test.cpp
What might be the problem with my actual project ?
Try asking in a g++ forum. There's (formally) no strtoll
function in C++ (yet). There is in C99, and I expect that most
C++ implementations make it available as an extension, but how
you turn the extension on depends on the implementation. (From
your description so far, I'd guess rather that there is
something in your production environment which turns it off.
But you'd have to ask the g++ experts what.)

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
May 30 '07 #4
After a lots of lots strugle, I found that there is

#define strtoll strtoq

In one of the 1000 include files.

Thanks for the help... Good lession for the debbuging....

May 31 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Steve | last post by:
can someone tell me how qsort function in <stdlib.h> is used (qsort(..........))? the function has a buffer, two void * parameters and the a pointer to a compare function. Thanks.
2
by: Jim Bish | last post by:
I am porting some code form vs2003 to vs2005 - it is unmanaged CPP. The solution consists of several library projects and a console project. The library projects all build fine but when I get to...
0
by: gangesmaster | last post by:
three-liner: reposted from python-dev for more feedback. it suggests to add the weakattr class to the standard weakref.py module. comments are welcome. ...
21
by: Anton Dec | last post by:
Just curious about this... malloc is defined in stdlib.h, right? But if I write a program without #include<stdlib.hand use malloc, it still works as expected. Why is this? Is malloc...
38
by: copx | last post by:
Are the macros min() and max() part of stdlib.h or not? (according to the standard?) I have the following problem: I defined my own min() / max() macros because my compiler (MinGW) does NOT...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.