QCC -V3.3.5,gcc_ntox86 malloc and strtof undeclared

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

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.

There is use or you can use the HelpViewer in photon.

Don’t assume QNX is like Linux :wink: Either you can try to port a different of grep or try something like :
find . -name “*.c” -exec grep -l “thestring” {}

/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]

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

There is no strtof, try strtod :stuck_out_tongue_winking_eye:

Alternate, atof