mex cpp file in ubuntu

7 ビュー (過去 30 日間)
zhang
zhang 2013 年 8 月 29 日
コメント済み: Masoud Ahookhosh 2016 年 8 月 8 日
Hi everyone
I'm trying to mex a cpp file in ubuntu using the following command.
mex triLinearVoting.cpp.
It gives me the following error:
Warning: You are using gcc version "4.6.3". The version currently supported with MEX is "4.4.x". For a list of currently supported compilers see: http://www.mathworks.com/support/compilers/current_release/ /usr/local/MATLAB/R2013a/bin/mex: 1: eval: g++: not found mex: compile of ' "triLinearVoting.cpp"' failed.
Thanks,

採用された回答

Walter Roberson
Walter Roberson 2013 年 8 月 29 日
It appears that you do not have g++ installed, and it appears that your gcc version is newer than mex has been tested with. The newer gcc is a warning that something might go wrong. But you need to install g++ to get any further.
  1 件のコメント
Aidin
Aidin 2014 年 11 月 4 日
I did download and install the gcc-4.4, but still getting the same warning message. Is it necessary to configure the Matlab current gcc compiler to the older version? If yes how?

サインインしてコメントする。

その他の回答 (2 件)

Aidin
Aidin 2014 年 11 月 4 日
編集済み: Aidin 2014 年 11 月 15 日
Finally, I configured Matlab to use an old gcc compiler (gcc-4.4 / Matlab 2013a / platform: Ubuntu 14.04). Here are the setp-by-step solution.
1) Install the old gcc required, here I installed gcc-4.4 and g++-4.4.
sudo apt-get install g++.4.4
sudo apt-get install gcc.4.4
2) Locate mexopts.sh file in the Matlab bin directory
sudo gedit /usr/locaL/MATLAB/R2013a/bin/mexopts.sh
and modify the following enteries:
CC='gcc' -> CC='gcc-4.4'
CC='g++' -> CC='g++-4.4'
3) Re-setup mex in Matlab using the modified mexopts.sh.
mex -setup
Choose the modified mexopts.sh when prompted for the options.
The options files available for mex are:
1: /usr/local/MATLABR2013a/bin/mexopts.sh :
Template Options file for building MEX-files
0: Exit with no changes
or directly give the path to the modified option file
mex -setup -f /usr/local/MATLABR2013a/bin/mexopts.sh
  2 件のコメント
Aditya Earanky
Aditya Earanky 2016 年 5 月 11 日
This worked for me! Thanks :)
Masoud Ahookhosh
Masoud Ahookhosh 2016 年 8 月 8 日
Thanks! Perfectly worked for me!

サインインしてコメントする。


Shashank Prasanna
Shashank Prasanna 2013 年 8 月 29 日
As the warning says you are using an unsupported version of the GCC compiler.
Use the support compiler:
And please take a look at the supported compiler page:
  1 件のコメント
Alexander
Alexander 2014 年 3 月 10 日
Can you please give a step-by-step solution? How do I point mex to the right version of GCC once it is dowloaded?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by