Getting error to link libmx.lib, libmat.lib, libeng.lib, libmex.lib in eclipse IDE with MinGW Compiler
8 views (last 30 days)
Show older comments
Hi,
I want to convert *.txt file to *.mat. So I am using matcreat.cpp. I included and mapped required header files in project. Then i starts getting error: g++ -o New_1.exe "src\\MatCreate.o" "src\\Main.o" "src\\INIReader.o" "src\\DataProcessing.o" src\MatCreate.o: In function `ZN9MatCreate13createMatFileEv': C:\Users\pr896\Downloads\New_1\Debug/../src/MatCreate.cpp:37: undefined reference to `matOpen' C:\Users\pr896\Downloads\New_1\Debug/../src/MatCreate.cpp:44: undefined reference to `mxCreateDoubleMatrix_730' C:\Users\pr896\Downloads\New_1\Debug/../src/MatCreate.cpp:51: undefined reference to `mxCreateDoubleMatrix_730' C:\Users\pr896\Downloads\New_1\Debug/../src/MatCreate.cpp:57: undefined reference to `mxGetPr' C:\Users\pr896\Downloads\New_1\Debug/../src/MatCreate.cpp:60: undefined reference to `mxCreateString' C:\Users\pr896\Downloads\New_1\Debug/../src/MatCreate.cpp:66: undefined reference to `matPutVariable' C:\Users\pr896\Downloads\New_1\Debug/../src/MatCreate.cpp:72: undefined reference to `matPutVariableAsGlobal' C:\Users\pr896\Downloads\New_1\Debug/../src/MatCreate.cpp:78: undefined reference to `matPutVariable' C:\Users\pr896\Downloads\New_1\Debug/../src/MatCreate.cpp:89: undefined reference to `mxGetPr' C:\Users\pr896\Downloads\New_1\Debug/../src/MatCreate.cpp:90: undefined reference to `matPutVariable' C:\Users\pr896\Downloads\New_1\Debug/../src/MatCreate.cpp:97: undefined reference to `mxDestroyArray' C:\Users\pr896\Downloads\New_1\Debug/../src/MatCreate.cpp:98: undefined reference to `mxDestroyArray' C:\Users\pr896\Downloads\New_1\Debug/../src/MatCreate.cpp:99: undefined reference to `mxDestroyArray' C:\Users\pr896\Downloads\New_1\Debug/../src/MatCreate.cpp:101: undefined reference to `matClose' C:\Users\pr896\Downloads\New_1\Debug/../src/MatCreate.cpp:109: undefined reference to `matOpen' C:\Users\pr896\Downloads\New_1\Debug/../src/MatCreate.cpp:118: undefined reference to `matGetVariable' C:\Users\pr896\Downloads\New_1\Debug/../src/MatCreate.cpp:123: undefined reference to `mxGetNumberOfDimensions_730' C:\Users\pr896\Downloads\New_1\Debug/../src/MatCreate.cpp:128: undefined reference to `matGetVariable' C:\Users\pr896\Downloads\New_1\Debug/../src/MatCreate.cpp:133: undefined reference to `mxIsFromGlobalWS' C:\Users\pr896\Downloads\New_1\Debug/../src/MatCreate.cpp:138: undefined reference to `matGetVariable' C:\Users\pr896\Downloads\New_1\Debug/../src/MatCreate.cpp:144: undefined reference to `mxGetString_730' C:\Users\pr896\Downloads\New_1\Debug/../src/MatCreate.cpp:155: undefined reference to `mxDestroyArray' C:\Users\pr896\Downloads\New_1\Debug/../src/MatCreate.cpp:156: undefined reference to `mxDestroyArray' C:\Users\pr896\Downloads\New_1\Debug/../src/MatCreate.cpp:157: undefined reference to `mxDestroyArray' C:\Users\pr896\Downloads\New_1\Debug/../src/MatCreate.cpp:159: undefined reference to `matClose' collect2.exe: error: ld returned 1 exit status
So I added libmx.lib, libmat.lib, libeng.lib, libmex.lib libraries in Project properties -> C/C++ Build -> MinGW C++ Linker -> Libraries also added path at library search path. Library search path is MATLAB->extern->lib->win32-> microsoft. I tried with win64 also. But getting same error.
The errors is: g++ "-LC:\\Software\\Mathworks\\32_bit_Matlab_All_Products_2010A_PSP_41\\extern\\lib\\win32\\microsoft" -o New_1.exe "src\\MatCreate.o" "src\\Main.o" "src\\INIReader.o" "src\\DataProcessing.o" -llibmx.lib -llibmat.lib -llibeng.lib -llibmex.lib c:/cpg_controls/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot find -llibmx.lib c:/cpg_controls/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot find -llibmat.lib c:/cpg_controls/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot find -llibeng.lib c:/cpg_controls/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot find -llibmex.lib collect2.exe: error: ld returned 1 exit status
My Windows 8.1 is 64 bit, MinGW is 32 bit and MATLAB 2010b 32 bit.
I am not getting whats wrong with this.
2 Comments
Santi Prats
on 4 May 2020
I'm getting the same error. Did anyone find the solution? Did the same with libmx, libmex and libmat.
Josue Flores de Valgas Torres
on 24 Aug 2021
Hi! I'm having the same problem righ now. Were you able to fix it?
Answers (0)
See Also
Categories
Find more on MATLAB Support for MinGW-w64 C/C++ Compiler in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!