IRTrans Shared Lib and C++

The place where software developers meet

Moderator: marcus

IRTrans Shared Lib and C++

Postby hadar » Wed 27. Aug 2008, 10:10

I am not able to use IRTrans Shared Lib in C++ programs. The linker produces "undefined reference" errors on IRTrans functions. I am using Linux and gcc compiler.

Everything works OK with C, the problem only exist when linking to C++ programs. I did another test. I renamed a C program (e.g. test.c) that compiles without errors as if it were C++ (e.g. test.cpp). Then when compiling there are "undefined reference" errors, although the code is just C.

¿Anybody knows how to solve this problem?
hadar
 
Posts: 1
Joined: Wed 27. Aug 2008, 09:36

Re: IRTrans Shared Lib and C++

Postby alexirion » Sat 6. Nov 2010, 15:56

You just have to include IRTrans.h like this:

extern "C"
{
#include "src/ir/IRTrans.h"
}

C++ has a different calling convention and this tells the compiler that it is a C function.

--Alex
alexirion
 
Posts: 9
Joined: Sat 6. Nov 2010, 15:48


Return to APIs

Who is online

Users browsing this forum: No registered users and 4 guests