compiling c and cpp using mex Matlab ubuntu
13 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Vaishnav Katiyar
on 28 Oct 2020
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 Comments
See Also
Categories
Find more on MATLAB Compiler in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!