错误3错误LNK1104:无法打开文件'gtk-3.lib' [英] Error 3 error LNK1104: cannot open file 'gtk-3.lib'
问题描述
我一直在努力让GTK 3.0工作,并遵循了这里的所有步骤。
3.0需要GTK才能工作,它似乎已经加载了它需要的所有东西来编译,但它给了我错误
错误3错误LNK1104:无法打开文件'gtk-3.lib'
每当我尝试运行该程序。
我使用的是visual studio 2012,但这是我唯一发现让GTK在任何视觉工作室上运行的地方。
下面是我使用的代码:
#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();
返回0;
}
我评论了gtk_widget_get_prefered_size调用,因为它与问题无关
有什么建议吗?
gtk- 3.lib
不存在。事实上,库引用不需要构建您的GTK 3应用程序。 pkg-config
helper似乎没有生成链接您的应用程序所需的正确链接器标志。 只是请在您的其他选项区域中添加GTK软件包(\ gtk3 \ lib)中找到的所有现有库。我的包(gtk + -bundle_3.6.4-20130921)的lib文件如下:
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
(或者你可以去图书馆然后输入 dir * .lib / B
)
不要忘记包含 / ENTRY:mainCRTStartup
标志在初始答案。
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.
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.
这篇关于错误3错误LNK1104:无法打开文件'gtk-3.lib'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!