compiling c and cpp using mex Matlab ubuntu
15 次查看(过去 30 天)
显示 更早的评论
I have installed Matlab 2018b on ubuntu 20. MEX is configured to use 'gcc' for C language compilation. I am facing two problems. First, the yprime.c is not found when I compile using mex
mex yprime.c
Error using mex
/media/imran_kanjoo/New Volume1/D/ZJU Data/HDR/softwre/MatlabEXR/yprime.c not found; check that you are in
the correct current folder, and check the spelling of '/media/imran_kanjoo/New Volume1/D/ZJU
Data/HDR/softwre/MatlabEXR/yprime.c'.
Secondly, how can I use gcc for compiling cpp files in Matlab? If I write,
mex exrread.cpp
Error using mex
No supported compiler was found. For options, visit https://www.mathworks.com/support/compilers.
p.s.
The installed compiler is gcc as given by
mex -setup c
MEX configured to use 'gcc' for C language compilation.
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. You will be required
to update your code to utilize the new API.
You can find more information about this at:
0 个评论
回答(1 个)
Vaishnav Katiyar
2020-10-28
This may happen if the OS installed is not an Ubuntu LTS version. Check the link below for System Requirements and Supported Compilers for Release 2018b:
The issue is due to no or corrupt installation of GCC. The default Ubuntu repositories contain a meta-package named “build-essential” that includes the GNU compiler collection, GNU debugger, and other development libraries and tools required for compiling software.
To install the Development Tools packages, run the following command as root or user with sudo privileges (The sudo command is designed to allow users to run programs with the security privileges of another user, by default the root user):
$ sudo apt update
$ sudo apt install build-essential
Verify that the GCC compiler is successfully installed by running the following command that prints the GCC version:
$ gcc –version
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!