1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Calling C++ functions from C project

Discussion in 'C++' started by arang1978, Jul 3, 2010.

  1. arang1978

    arang1978 New Member

    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.


  2. jimblumberg

    jimblumberg New Member

    The error messages undefined references usually mean that you have not included all of the required

  3. arang1978

    arang1978 New Member

    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.


Share This Page