Linker errors with libeng.lib and 64-bit Cygwin g++

2 views (last 30 days)
Al
Al on 18 Apr 2014
Greetings.
I am porting a VS2010 project that embeds a Matlab engine in a C++ program to Cygwin g++ on 64-bit Windows. A test program, MServer.cpp, opens a Matlab engine and evaluates a 'clear' command (source file below.)
When I try to compile and link a test program using the following command line,
g++ MServer.cpp \
-I "/cygdrive/c/Program Files/MATLAB/R2013b/extern/include"/ \
-L "/cygdrive/c/Program Files/MATLAB/R2013b/extern/lib/win64/microsoft"/ \
-llibeng
I get the following errors:
/cygdrive/c/Program Files/MATLAB/R2013b/extern/lib/win64/microsoft//libeng.lib(libeng.dll.b):(.text+0x2): relocation truncated to fit: R_X86_64_32 against symbol `__imp_engEvalString' defined in .idata$5 section in /cygdrive/c/Program Files/MATLAB/R2013b/extern/lib/win64/microsoft//libeng.lib(libeng.dll.b) /cygdrive/c/Program Files/MATLAB/R2013b/extern/lib/win64/microsoft//libeng.lib(libeng.dll.b):(.text+0x2): relocation truncated to fit: R_X86_64_32 against symbol `__imp_engOpen' defined in .idata$5 section in /cygdrive/c/Program Files/MATLAB/R2013b/extern/lib/win64/microsoft//libeng.lib(libeng.dll.b) collect2: error: ld returned 1 exit status
I read that 'relocation truncated' is normally related to a segment > 2 Gb, so I added '-mcmodel=large' to the g++ command line - no improvement.
Help appreciated, thank you.
#include "engine.h"
int main (void)
{
Engine *matlab;
if (!(matlab = engOpen("\0")))
return 1;
engEvalString(matlab, "clear;");
return 0;
}

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!