Calling C++ functions from C project

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

  1. arang1978

    arang1978 New Member

    Joined:
    Jul 3, 2010
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    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



     
  2. jimblumberg

    jimblumberg New Member

    Joined:
    May 30, 2010
    Messages:
    120
    Likes Received:
    29
    Trophy Points:
    0
    The error messages undefined references usually mean that you have not included all of the required
    libraries.

    Jim
     
  3. arang1978

    arang1978 New Member

    Joined:
    Jul 3, 2010
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    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.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice