After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 568416 - undefined reference to Gtk::Stock::ORIENTATION_*
undefined reference to Gtk::Stock::ORIENTATION_*
Status: RESOLVED FIXED
Product: gtkmm
Classification: Bindings
Component: general
2.14.x
Other Windows
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2009-01-20 12:28 UTC by Tao Wang
Modified: 2009-01-20 16:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch (1.35 KB, patch)
2009-01-20 12:51 UTC, Tao Wang
none Details | Review

Description Tao Wang 2009-01-20 12:28:18 UTC
Got linking error when compiling the following program:

#include <gtkmm.h>

int main(int argc, char* argv[])
{
	Gtk::Main kit(argc, argv);
	//	test gtk stock
	new Gtk::Button(Gtk::Stock::ORIENTATION_PORTRAIT);
	new Gtk::Button(Gtk::Stock::ORIENTATION_LANDSCAPE);
	new Gtk::Button(Gtk::Stock::ORIENTATION_REVERSE_PORTRAIT);
	new Gtk::Button(Gtk::Stock::ORIENTATION_REVERSE_LANDSCAPE);
	return 0;
}

and receive the following error under Ubuntu:


tao@vm-ubuntu:~/temp$ pkg-config --modversion gtkmm-2.4
2.14.1
tao@vm-ubuntu:~/temp$ g++ test_stock.cpp -o test_stock `pkg-config gtkmm-2.4 --cflags --libs`
/tmp/ccifPF87.o: In function `main':
test_stock.cpp:(.text+0x1c7): undefined reference to `Gtk::Stock::ORIENTATION_PORTRAIT'
test_stock.cpp:(.text+0x25b): undefined reference to `Gtk::Stock::ORIENTATION_LANDSCAPE'
test_stock.cpp:(.text+0x2ef): undefined reference to `Gtk::Stock::ORIENTATION_REVERSE_PORTRAIT'
test_stock.cpp:(.text+0x383): undefined reference to `Gtk::Stock::ORIENTATION_REVERSE_LANDSCAPE'


The error also happened under Windows version, which got the following linking error:


1>Linking...
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) struct Gtk::BuiltinStockID const Gtk::Stock::ORIENTATION_REVERSE_PORTRAIT" (__imp_?ORIENTATION_REVERSE_PORTRAIT@Stock@Gtk@@3UBuiltinStockID@2@B)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) struct Gtk::BuiltinStockID const Gtk::Stock::ORIENTATION_REVERSE_LANDSCAPE" (__imp_?ORIENTATION_REVERSE_LANDSCAPE@Stock@Gtk@@3UBuiltinStockID@2@B)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) struct Gtk::BuiltinStockID const Gtk::Stock::ORIENTATION_LANDSCAPE" (__imp_?ORIENTATION_LANDSCAPE@Stock@Gtk@@3UBuiltinStockID@2@B)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) struct Gtk::BuiltinStockID const Gtk::Stock::ORIENTATION_PORTRAIT" (__imp_?ORIENTATION_PORTRAIT@Stock@Gtk@@3UBuiltinStockID@2@B)
1>C:\Users\Tao\Documents\Visual Studio 2008\Projects\gtkmm\Debug\gtkmm_minidemo.exe : fatal error LNK1120: 4 unresolved externals


I tested all Gtk::Stock::*, and only the ORIENTATION_* got this linking errors.
Comment 1 Tao Wang 2009-01-20 12:51:58 UTC
Created attachment 126832 [details] [review]
proposed patch

The bug may caused by missing assignments in gtk/gtkmm/stock.cc. The proposed patch contains the missing assignments.
Comment 2 Murray Cumming 2009-01-20 16:40:38 UTC
Good catch. Fixed with this commit in svn trunk and the gtkmm-2-14 branch:

2009-01-20  Murray Cumming  <murrayc@murrayc.com>

	* gtk/gtkmm/stock.cc: Actually define and initialize 
	ORIENTATION_PORTRAIT, ORIENTATION_LANDSCAPE, 
	ORIENTATION_REVERSE_LANDSCAPE, and ORIENTATION_REVERSE_PORTRAIT, 
	avoiding undefined reference errors when trying to use these.
	Bug #568416 (Tao Wang).