LoginSignup
0
0

More than 5 years have passed since last update.

Ubuntu では g++ に指定するライブラリの順番に気を付けないと undefined reference

Last updated at Posted at 2017-05-22

参照されるライブラリは後ろに書かないといけないらしい。
https://lists.ubuntu.com/archives/ubuntu-devel/2010-November/031991.html
http://www.hakodate-ct.ac.jp/~tokai/tokai/gtkmm/etc/p1.htm

コマンドライン、Makefile、CMakeでのそれぞれ回避策は以下の通り。

.bashrc
alias g++='g++ -Wl,--no-as-needed'
Makefile
 LDFLAGS=-Wl,--no-as-needed
CMakeLists.txt
 set (CMAKE_EXE_LINKER_FLAGS -Wl,--no-as-needed) 
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0