Answer the question
In order to leave comments, you need to log in
`
Linking GTK-3.0 C++ app with MinGW: undefined reference to `[email protected]'?
I'm building an application written in C++11 using the GTK-3.0 library using the g++ utility. For some reason, you need to build *.o files first, which is done successfully with a command like this (the command is applied separately to each sort):
g++ -w -std=c++11 -c <src file name> -o .\obj\<src file name>.o <вывод команды 'pkg-config --cflags gtk+-3.0'> -I<path to sources>
g++ <вывод команды 'pkg-config --libs gtk+-3.0'> -o ".\bin\myapp.exe" <list of *.o files>
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libmingw32.a(main.o):main.c:(.text.startup+0xa7): undefined reference to `[email protected]'
collect2.exe: error: ld returned 1 exit status
int main(int argc, char* argv[]) {
//...
}
pkg-config gtk+-3.0 --libs
-LC:/libs/GTK/lib -lgtk-3 -lgdk-3 -lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid -lpangocairo-1.0 -lpangoft2-1.0 -lfreetype -lfontconfig -lpangowin32-1.0 -lgdi32 -lpango-1.0 -lm -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl
pkg-config --cflags gtk+-3.0
-mms-bitfields -IC:/libs/GTK/include/gtk-3.0 -IC:/libs/GTK/include/cairo -IC:/libs/GTK/include/pango-1.0 -IC:/libs/GTK/include/atk-1.0 -IC:/libs/GTK/include/cairo -IC:/libs/GTK/include/pixman-1 -IC:/libs/GTK/include -IC:/libs/GTK/include/freetype2 -IC:/libs/GTK/include -IC:/libs/GTK/include/libpng15 -IC:/libs/GTK/include/gdk-pixbuf-2.0 -IC:/libs/GTK/include/libpng15 -IC:/libs/GTK/include/glib-2.0 -IC:/libs/GTK/lib/glib-2.0/include
Answer the question
In order to leave comments, you need to log in
Show what pkg-config wrote there.
Do you have main?
Are you compiling under offtopic (Windows)?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question