Matlab Kalman /usr/bin/ld: cannot find -lstdc++
Asked Answered
S

5

34

I'm following the Matlab coder kalman tutorial in Matlab help. When using codegen, there's an error as below:

/usr/bin/ld: cannot find -lstdc++

collect2: ld returned 1 exit status

But there is libstdc++.so.6 in /lib/ and /usr/lib

Sirdar answered 2/11, 2012 at 12:18 Comment(4)
What command did you use to compile you code? Also, is the source code C++ or C?Sedentary
matlab code...codegen -report kalman02.m -args {z}Sirdar
Might be a 32/64 bit issue. What kind of system do you have?Synectics
OK so that explains it. You need to either install 32-bit libraries, or use -m64 compiler flag.Synectics
T
62

For Fedora 16 use:

sudo yum install libstdc++-static
Tav answered 22/2, 2013 at 1:22 Comment(6)
Fixed my problem on Fedora 21. Thanks!Pageantry
The same, worked on Ubuntu but Fedora needed the above.Craal
Wouldn't build-essential take care of all that?Brushwork
@Brushwork build-essential is a Ubuntu package. OP uses Fedora.Collyrium
I also needed this in Centos 7.5Starfish
Running sudo dnf install libstdc++-static saved my life. Thank you.Summersummerhouse
D
13

You can soft link the library to the name that is being sought

ln -s /usr/lib/libstdc++.so.6 /usr/lib/libstdc++.so

Doleful answered 24/11, 2015 at 4:58 Comment(1)
For Ubuntu 14 try: ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/lib/x86_64-linux-gnu/libstdc++.soBelated
M
6

If you're compiling a 32-bit application on a 64-bit CentOS 7:

sudo yum install libstdc++-devel.i686
Mccown answered 14/7, 2015 at 16:2 Comment(1)
Following this website (tech.yipp.ca/compile-error/…), I found that the command: sudo yum install libstdc++-static libstdc++-static.i686 is more appropriate. Tried in my machine and worked.Offing
E
6

i did sudo apt-get install g++-4.7 it work for me for matlab .

Estrous answered 8/7, 2016 at 16:51 Comment(0)
B
1

For CentOS, be sure you have installed gcc-c++ package (it includes libstdc++-devel dependency):

sudo yum install gcc-c++
Beamer answered 22/4, 2015 at 8:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.