Error 3 error LNK1104: cannot open file 'gtk-3.lib'

gtk, gtk3, visual-studio, visual-studio-2012

Solution

The library `gtk-3.lib` does not exist. In fact, the library reference is not required to build your GTK 3 application. The `pkg-config` helper doesn't seem to generate the correct linker flags needed to link your application.

Just add in your Additional Options area all the existing libraries found in your GTK package (\gtk3\lib). The lib files for my bundle (gtk+-bundle_3.6.4-20130921) were as follows:

atk-1.0.lib cairo.lib fontconfig.lib gailutil.lib gdk-win32-3.0.lib gdk_pixbuf-2.0.lib gio-2.0.lib glib-2.0.lib gmodule-2.0.lib gobject-2.0.lib gthread-2.0.lib gtk-win32-3.0.lib pango-1.0.lib pangocairo-1.0.lib pangoft2-1.0.lib pangowin32-1.0.lib

(or you can go to your library path via a command prompt and enter `dir *.lib /B`)

Don't forget to include the `/ENTRY:mainCRTStartup` flag mention in the initial answer you started with.

Problem

I have been trying to get GTK 3.0 to work, and have followed all the steps here How to configure gtk on Visual studio 2010 And changing to 3.0 where needed to get GTK to work, and it seems to have loaded everything it needs in order to compile, but it gives me the error ``` Error 3 error LNK1104: cannot open file 'gtk-3.lib' ``` Whenever I try to run the program. I am using visual studios 2012, but this was the only place i found anything about getting GTK to run on any visual studios. Here is the code I am using: ``` #include <gtk-3.0\gtk\gtk.h> int main(int argc, char* argv[]) { gtk_init(&argc, &argv); GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL); //gtk_widget_get_preferred_size(window, 300, 200); g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL); gtk_window_set_title(GTK_WINDOW(window), "GTK+ with VS2010"); gtk_widget_show(window); gtk_main(); return 0; } ``` I commented out the gtk_widget_get_prefered_size call because it is irrelevant to the problem any suggestions? I've looked in several places but none came up with clear answers.

Original source

Related problems