对“gdk_color_parse”的未定义引用
Undefined reference to `gdk_color_parse'
我正在使用 GTK + 3.0 Lib,但出现错误:
Undefined reference to `gdk_color_parse'
我的源代码:
int
connectPS3(GtkWidget *button)
{
HINSTANCE hLib;
hLib = LoadLibrary("CCAPI.DLL");
gchar *ip;
ip = "192.168.0.40";
__cConnect v_connectPS3 = GetProcAddress(hLib, "CCAPIConnectConsole");
__cNotify v_notifyPS3 = GetProcAddress(hLib, "CCAPIVshNotify");
GdkColor color;
if (v_connectPS3(ip) == 0)
{
v_notifyPS3(TROPHY2, "Connected to PS3");
gtk_button_set_label(GTK_BUTTON(button), "Connected");
gdk_color_parse("green", &color);
gtk_widget_modify_bg(button, GTK_STATE_NORMAL, &color);
}
else
{
gtk_button_set_label(GTK_BUTTON(button), "Can't connect to IP Address");
gdk_color_parse("red", &color);
gtk_widget_modify_bg(button, GTK_STATE_NORMAL, &color);
}
return (0);
}
因此,如果有人能告诉我为什么会这样,我将不胜感激。
我没有链接器设置。
根据 this 之前的回答,您的编译语句似乎需要进行一些更改。
但是,一般来说,请检查以下几点,
- 所有使用的库(需要)都应该链接到。
- The order of appearance of libraries matter,所以重新检查依赖关系的顺序。
我正在使用 GTK + 3.0 Lib,但出现错误:
Undefined reference to `gdk_color_parse'
我的源代码:
int
connectPS3(GtkWidget *button)
{
HINSTANCE hLib;
hLib = LoadLibrary("CCAPI.DLL");
gchar *ip;
ip = "192.168.0.40";
__cConnect v_connectPS3 = GetProcAddress(hLib, "CCAPIConnectConsole");
__cNotify v_notifyPS3 = GetProcAddress(hLib, "CCAPIVshNotify");
GdkColor color;
if (v_connectPS3(ip) == 0)
{
v_notifyPS3(TROPHY2, "Connected to PS3");
gtk_button_set_label(GTK_BUTTON(button), "Connected");
gdk_color_parse("green", &color);
gtk_widget_modify_bg(button, GTK_STATE_NORMAL, &color);
}
else
{
gtk_button_set_label(GTK_BUTTON(button), "Can't connect to IP Address");
gdk_color_parse("red", &color);
gtk_widget_modify_bg(button, GTK_STATE_NORMAL, &color);
}
return (0);
}
因此,如果有人能告诉我为什么会这样,我将不胜感激。
我没有链接器设置。
根据 this 之前的回答,您的编译语句似乎需要进行一些更改。
但是,一般来说,请检查以下几点,
- 所有使用的库(需要)都应该链接到。
- The order of appearance of libraries matter,所以重新检查依赖关系的顺序。