I want to use C++ code to produce .mat files under 64 bit Windows 10 with mingw MSYS2. Therefore, I wanted to take a look at the example matcreat.cpp (MATLAB command:
edit([matlabroot '/extern/examples/eng_mat/matcreat.cpp']);
). In contrast to compilation error, I can successfully compile the cpp file with the following command:
g++ -c -I/c/Program\ Files/MATLAB/R2016a/extern/include matcreat.cpp -o matcreat.o
g++ -o matcreat matcreat.o -L/c/Program\ Files/MATLAB/R2016a/bin/win64 -lmex -lmat -lmx -leng -lstdc++
But when I run the program with
./matcreat.exe
I get the error message
my_directory/matcreat.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory
although I added
C:\Program Files\MATLAB\R2016a\bin\win64
to my Windows environment variable. Any ideas to solve that problem are highly appreciated.

댓글 수: 2

Walter Roberson
Walter Roberson 2016년 9월 27일
You need Dependency Walker or equivalent to figure out which shared library is giving the problem.
Thanks for that tip. When running it I get the following output:
Error: At least one required implicit or forwarded dependency was not found.
Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
Error: Modules with different CPU types were found.
Error: A circular dependency was detected.
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
The profiler says that there is an undefined reference to
__gxx_personality_seh0
After googling, that behavior usually happens when people use gcc instead of g++, which is unfortunately not my case.

댓글을 달려면 로그인하십시오.

 채택된 답변

Ahmed Hraoui
Ahmed Hraoui 2016년 9월 29일

1 개 추천

Since some other files, which worked before, did not work anymore, I thought about my previous changes and found out that I had the same MATLAB path as global as well as user specific path variable. Deleting the user specific one solved the problem and everything is working now.

추가 답변 (0개)

카테고리

질문:

2016년 9월 27일

답변:

2016년 9월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by