Calling Matlab engine from C++

  • Follow


I want to write a C++ program on Linux/Eclipse that uses the matlab engine routines.  As a starting point I'm trying to compile and run the engdemo.cpp example.  It compiles without errors but I get a linker error - cannot find -llibeng.

As far as I can tell, libeng is installed and I have the paths set correctly in Eclipse.  Any suggestions?

Thanks.
0
Reply Deborah 12/8/2009 3:39:02 PM

"Deborah " <dmarg@comcast.net> wrote in message <hflrum$rp5$1@fred.mathworks.com>...
> I want to write a C++ program on Linux/Eclipse that uses the matlab engine routines.  As a starting point I'm trying to compile and run the engdemo.cpp example.  It compiles without errors but I get a linker error - cannot find -llibeng.
> 
> As far as I can tell, libeng is installed and I have the paths set correctly in Eclipse.  Any suggestions?
> 
> Thanks.

What commands do you use to compile with?

James Tursa
0
Reply James 12/8/2009 3:56:03 PM


On 8 Des, 16:39, "Deborah " <dm...@comcast.net> wrote:
> I want to write a C++ program on Linux/Eclipse that uses the matlab engin=
e routines. =A0As a starting point I'm trying to compile and run the engdem=
o.cpp example. =A0It compiles without errors but I get a linker error - can=
not find -llibeng.
>
> As far as I can tell, libeng is installed and I have the paths set correc=
tly in Eclipse. =A0Any suggestions?

Double-check and triple-check the paths.

Remember that the include directory for headers is
different from the include directory for the linker.
Both have to be set correctly.

If you can, have your compiler / linker report what
it attempts to do (use the 'verbose', often -v, compiler
option). Make sure all your linker paths etc are indeed
set as you want them to. Some times IDEs son't quite
work as they are supposed to, and such options don't
reach the actual makefile.

Since you use C++, that mangles the names in the object
code, make sure your compiler/linker combo is supported.
As I understand it - I might be wrong - libraries that
are compiled with one compiler / linker combo might not
necessarily be linkable to code compiled with other tools.

Rune
0
Reply Rune 12/8/2009 4:06:00 PM

"Deborah " <dmarg@comcast.net> wrote in message <hflrum$rp5$1@fred.mathworks.com>...
> I want to write a C++ program on Linux/Eclipse that uses the matlab engine routines.  As a starting point I'm trying to compile and run the engdemo.cpp example.  It compiles without errors but I get a linker error - cannot find -llibeng.
> 
> As far as I can tell, libeng is installed and I have the paths set correctly in Eclipse.  Any suggestions?
> 
> Thanks.

Try one of the following:

In the Properties->C/C++ Build->Settings, tool settings tag under "Libraries" try either "libeng" or "eng" with the " ". 
0
Reply jonnyrandall (5) 2/12/2010 12:00:22 AM

3 Replies
402 Views

(page loaded in 0.078 seconds)

Similiar Articles:













7/24/2012 2:36:07 AM


Reply: