Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   Calling C++ functions from C project (http://www.go4expert.com/forums/calling-cpp-functions-c-project-t22627/)

arang1978 3Jul2010 19:48

Calling C++ functions from C project
 
Hello Friends,

I need help to integrate a open source code which is written in C++ (Live555 RTSP source code) into my project which is written in C language.

I have renamed the int main (int argc, char **argv) function which is in C++ to
extern "C" int rtsp_main (int argc, char **argv)
and called it from my main () in my project which is C language.

I get a lot of error like below
playCommon.cpp:(.text+0x25c): undefined reference to `operator*(short, DelayInterval const&)'
playCommon.cpp:(.text+0x260): undefined reference to `DELAY_SECOND'
playCommon.cpp:(.text+0x298): undefined reference to `operator*(short, DelayInterval const&)'
playCommon.cpp:(.text+0x2c0): undefined reference to `operator*(short, DelayInterval const&)'
../lib//libliveMedia.a(playCommon.o): In function `main_RTSPClient':
playCommon.cpp:(.text+0x3144): undefined reference to `BasicTaskScheduler::createNew()'


If any of you let me know the easy way to use the C++ project in C project then it will be easy for me.

My e-mail ID is arang1978@gmail.com

Thanks in advance.

Regards,
Arang




jimblumberg 9Jul2010 20:31

Re: Calling C++ functions from C project
 
The error messages undefined references usually mean that you have not included all of the required
libraries.

Jim

arang1978 10Jul2010 11:54

Re: Calling C++ functions from C project
 
Hello Mr.Jim,

Thank you for your help. As you told me, I didn't include some libraries. I have included them now. And there is no compilation errors now.

Regards,
Arang.


All times are GMT +5.5. The time now is 17:17.