Help us understand the problem. What is going on with this article?

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

More than 3 years have passed since last update.

参照されるライブラリは後ろに書かないといけないらしい。
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) 
k1iguchi
投稿内容は個人の見解であり、所属組織の立場、戦略、意見を代表するものではありません。
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away