I made shared library using gcc . I would like to link this library using g++ comiler with source code *.c. Example
test_init.c #include<stdio.h> int test_init() { printf(" test init success\n"); return 0; } gcc -shared -o libtest.so test_init.c
test.c
#include<stdio.h> extern int test_init(); main() { test_init(); } g++ -I. -L. -ltest test.c
/tmp/ccuH5tIO.o: In function
main': test.c:(.text+0x7): undefined reference totest_init()' collect2: ld returned 1 exit status
Note: If i compile test.c with gcc it works, but i would like to use this approach due to other dependencies. Is it possible??