--------------------------------------------------------------------------------
hi ! sorry for the lenght of this post.
i'm using KDevelop 3.3.1 on Ferdora Core 5
i create a C project with Automanke Manager, add main.c ,LibBkTrans.h into it.
//main.c
#include "BkTransLib.h"
int main() {
if (BKInit())
{
//do nothing
}
}
//BkTransLib.h
int BKInit();
a shared library libbktrans.so.0.0 contains the implementation of BKInit(), i put it in /usr/local/lib and install it correctly
i build the project --> error: "undefined reference to BKInit(), it's because i haven't linked against the shared library
so i right-click on the project name (Program in bin)in Automake Manager window, choose Options, in the tab Libraries i add
-lbktrans into the box "Link libraries outside the project(LDADD)"
at last i rebuid the project --> Success
now i delete file /path_to_project/src/Makefile.in and the whole directory /path_to_project/debug
then i remove the main.c from the project, go to /path_to_project/src and rename main.c to main.cpp, no problem, cause the main.c is very simple like above.
i add this main.cpp into the project and rebuid --> error: "undefined reference to BKInit()"
i don't know why.
i try another approach: create a C++ project, add main.ccp and BkTransLib.h into it
build --> error: "undefined reference to BKInit()"
i link the library by adding -lbktrans into the box "Link libraries outside the project(LDADD)"
rebuild --> error: "undefined reference to BKInit()".
perhaps, the shared library can't link into a C++ project.(this is my very stupid idea !)
because i was successful to link against a simple shared library to both C and C++ project.
does anyone have a better idea ?
Regards
nhatkhang