OpenQNX :: The QNX Community Portal

May 13, 2008 - 12:36 PM
Google
  Web openqnx.com   
     Create an account Home · Submit News · QNX Forums · QNX Download · Search   
_
Main Menu
Who's Online
There are 54 unlogged users and 1 registered user online.

You can log-in or register for a user account here.

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
bricedebrignaisplage
Post subject: QCC -V3.3.5,gcc_ntox86 malloc and strtof undeclared  PostPosted: Mar 28, 2008 - 08:15 AM
New Member


Joined: Dec 04, 2007
Posts: 6
Location: singapore
I switched to using QCC -V3.3.5,gcc_ntox86 to try to solve a problem with working with my own shared library. I was previously compiling with g++.

So QCC 3.3.5 complains about malloc and strtof not being declared, although I do include stdlib.h (and I also tried with cstdlib).

Is there a way I can fix that?

And some others related queries:

is there no man page under QNX?

How to grep recursive (grep -niRH doesn't work)?

What are the standard header files used by QCC 3.3.5? Those in /usr/include?


Thanks
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
mario
Post subject: Re: QCC -V3.3.5,gcc_ntox86 malloc and strtof undeclared  PostPosted: Mar 28, 2008 - 09:42 AM
QNX Master


Joined: Sep 01, 2002
Posts: 2667

bricedebrignaisplage wrote:
I switched to using QCC -V3.3.5,gcc_ntox86 to try to solve a problem with working with my own shared library. I was previously compiling with g++.

So QCC 3.3.5 complains about malloc and strtof not being declared, although I do include stdlib.h (and I also tried with cstdlib).

Is there a way I can fix that?


About strtof not sure but malloc is definitely there, must be a linker issue not a compiler one. Post the exact error and the command line you are using.

bricedebrignaisplage wrote:
And some others related queries:

is there no man page under QNX?


There is use <command> or you can use the HelpViewer in photon.

bricedebrignaisplage wrote:
How to grep recursive (grep -niRH doesn't work)?


Don't assume QNX is like Linux ;-) Either you can try to port a different of grep or try something like :
find . -name "*.c" -exec grep -l "thestring" {}


bricedebrignaisplage wrote:
What are the standard header files used by QCC 3.3.5? Those in /usr/include?


/usr/include is just for convenience the include are in /usr/qnx6../target/qnx6/usr/include/..

There are various directory for each matching version of GCC you may have (for examle 4.2.1 will add its own set of header files)


Thanks[/quote]
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
bricedebrignaisplage
Post subject: RE: Re: QCC -V3.3.5,gcc_ntox86 malloc and strtof undeclared  PostPosted: Apr 02, 2008 - 08:46 AM
New Member


Joined: Dec 04, 2007
Posts: 6
Location: singapore
I wrote the following test code to test the strtof and malloc undefined issue.


#include <stdlib.h>
#include <string.h>
#include <assert.h>

int main() {
char *p = (char *) malloc(100);
assert(p!=NULL);
strcpy(p,"23.69");
float f = strtof(p,NULL);
return 0;
}


I compile with the following command:
QCC -V3.3.5,gcc_ntox86 testStdlib.cc -o testStdlib

And the result is:
testStdlib.cc: In function `int main()':
testStdlib.cc:9: error: `strtof' undeclared (first use this function)
testStdlib.cc:9: error: (Each undeclared identifier is reported only once for
each function it appears in.)
cc: /usr/qnx632/host/qnx6/x86/usr/lib/gcc-lib/i386-pc-nto-qnx6.3.0/3.3.5/cc1plus error 1
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
micro
Post subject: RE: Re: QCC -V3.3.5,gcc_ntox86 malloc and strtof undeclared  PostPosted: Apr 02, 2008 - 01:01 PM
Senior Member


Joined: Jul 22, 2004
Posts: 315

There is no strtof, try strtod ;P
 
 View user's profile Send private message  
Reply with quote Back to top
micro
Post subject: RE: Re: QCC -V3.3.5,gcc_ntox86 malloc and strtof undeclared  PostPosted: Apr 02, 2008 - 01:31 PM
Senior Member


Joined: Jul 22, 2004
Posts: 315

Alternate, atof
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2007 The PNphpBB Group
Credits
All logos and trademarks in this site are property of their respective owners. The comments are property of their posters.
Powered by OpenQNX: The QNX Community Portal Site
QNX and the QNX logo are registered trademarks of QNX Software Systems.