link c code with c++ code using g++

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • J.Artieda

    #1

    link c code with c++ code using g++

    I compile one object using gcc and another using g++ then i use g++ to link
    the to objects and i get that the fuctions of the c object are unknown
    references for the c++ object.
    can any body explain me how can i link c code with c++ code ?
    i tried extern "C" but seems that that doesn't compile with g++
    thanks jorge


  • Ravi

    #2
    Re: link c code with c++ code using g++

    Compile all your source code (both C and C++) using g++ and use the
    extern C feature to turn off name mangling for the C functions.
    HTH,
    Ravi.


    J.Artieda wrote:[color=blue]
    > I compile one object using gcc and another using g++ then i use g++ to link
    > the to objects and i get that the fuctions of the c object are unknown
    > references for the c++ object.
    > can any body explain me how can i link c code with c++ code ?
    > i tried extern "C" but seems that that doesn't compile with g++
    > thanks jorge
    >
    >[/color]

    Comment

    Working...