Linking C library in C++ application
-
I am linking a C library in C++ application. i have declared function in my c.h #ifdef __cplusplus extern "C" { #endif int fun(int,int); #ifdef __cplusplus } #endif created my c.lib now in my capp.cpp i have included this c.h as #include "c.h" and i have linked the c.lib and calling this fun function in my cpp application as int x=fun(2,3); directly ... would this work ?? how can i be sure that the library is linked propery ??
-
I am linking a C library in C++ application. i have declared function in my c.h #ifdef __cplusplus extern "C" { #endif int fun(int,int); #ifdef __cplusplus } #endif created my c.lib now in my capp.cpp i have included this c.h as #include "c.h" and i have linked the c.lib and calling this fun function in my cpp application as int x=fun(2,3); directly ... would this work ?? how can i be sure that the library is linked propery ??
Should work. Sounds like you've done everything correctly.
Steve