Then I compile the file by using:
qcc mytest.c -o mytest
It show the following message:
warning: assignment makes pointer from integer without a cast
It seems that input_line() return an integer instead char* pointer
I change mytest.c to mytest.cpp, and then compile it with,
QCC mytest.cpp -o mytest
It show the following message:
mytest.cpp:16: implicit declaration of function ‘int input_line(…)’
cc: /usr/lib/gcc-lib/ntox86/2.95.2/cc1plus error 33
So I have two question:
why doesn’t input_line() return a char * pointer just as it is
described in library Reference
Then I compile the file by using:
qcc mytest.c -o mytest
It show the following message:
warning: assignment makes pointer from integer without a cast
It seems that input_line() return an integer instead char* pointer
No, that is because the compiler couldn’t find a prototype for the
function hence it default to a function returning int. If you bump up
the warning level I’m pretty sure you would see a warning about
prototype not found
I change mytest.c to mytest.cpp, and then compile it with,
QCC mytest.cpp -o mytest
It show the following message:
mytest.cpp:16: implicit declaration of function ‘int input_line(…)’
cc: /usr/lib/gcc-lib/ntox86/2.95.2/cc1plus error 33
That proves my theory C++ is more senstive to function not being
defined.
So I have two question:
why doesn’t input_line() return a char * pointer just as it is
described in library Reference
why doesn’t QCC supprot this fuction
ps. all my work is under QNX6.1
Looking at the header file stdio.h the prototype for input_line is
surrounded by ifdef:
So I’m not sure what the solution is. Personally since this is a QNX4
function I would not use it all together. (The documentation says that
QNX4 function should not be used in Neutrino expect for porting
consideration)
Then I compile the file by using:
qcc mytest.c -o mytest
It show the following message:
warning: assignment makes pointer from integer without a cast
It seems that input_line() return an integer instead char* pointer
No, that is because the compiler couldn’t find a prototype for the
function hence it default to a function returning int. If you bump up
the warning level I’m pretty sure you would see a warning about
prototype not found
I change mytest.c to mytest.cpp, and then compile it with,
QCC mytest.cpp -o mytest
It show the following message:
mytest.cpp:16: implicit declaration of function ‘int
input_line(…)’
cc: /usr/lib/gcc-lib/ntox86/2.95.2/cc1plus error 33
That proves my theory > > C++ is more senstive to function not being
defined.
So I have two question:
why doesn’t input_line() return a char * pointer just as it is
described in library Reference
why doesn’t QCC supprot this fuction
ps. all my work is under QNX6.1
Looking at the header file stdio.h the prototype for input_line is
surrounded by ifdef:
So I’m not sure what the solution is. Personally since this is a QNX4
function I would not use it all together. (The documentation says that
QNX4 function should not be used in Neutrino expect for porting
consideration)