int fun2(int a , int b )
{
printf(“a+b=%d\n”,(a+b) );
return (a+b);
}
my main code: #include <stdio.h>
int main( void )
{
int sum;
fun1();
sum=fun2(2,6);
printf(“sum=%d\n”,sum);
return EXIT_SUCCESS;
}
but there are some error when I build it.
*** [C:/QNX630/workex/get-local_time/x86/o/get-local_time] Error 1
*** [C:/QNX630/workex/get-local_time/x86/o-g/get-local_time_g] Error get-local_time.o * In function main': undefined reference to fun1’
get-local_time.o * undefined reference to fun1' undefined reference to fun2’
undefined reference to fun1' undefined reference to fun2’
If I use the comm on the command line , the shared library is normal.
But I want to use QNX IDE to make and debug the shared library.
I don’t have idea. Help!
難道IDE沒有這個功能嗎?
/*Gain access to an executable object file */
/*shared library path → “/root/shared_lib/libsharecreat.so” */
handle = dlopen("/root/shared_lib/libsharecreat.so" ,RTLD_NOW );
if(handle == NULL)
{
printf(“link library open failed\n”);
exit(0);
}
/Get the address of a symbol in a shared object-function 1/
/* “TestFM” is function 1’s name*/
brain = (foofunc) dlsym( handle, “TestFM” );
if(brain == NULL)
{
printf(“link library open failed\n”);
exit(0);
}
printf(“temp is=%d\n”,(*brain)(10));