Gtk Error在没有强制转换的情况下从整数生成指针

时间:2015-01-01 18:30:09

标签: c gtk gtksourceview

我尝试创建一个简单的ide,我得到了这个错误!! 当我编译代码时,我发现了这个错误

gcc -c editor.c -Werror -g `pkg-config --cflags gtk+-3.0 gtksourceview-3.0` `pkg-config --libs gtk+-3.0 gtksourceview-3.0`
editor.c: In function ‘editor_create’:
editor.c:40:10: error: assignment makes pointer from integer without a cast [-Werror]
buffer  = gtk_source_buffer_new (NULL);
      ^
editor.c:41:10: error: assignment makes pointer from integer without a cast [-Werror]
langm   = gtk_source_language_manager_new ();
      ^
editor.c:42:7: error: assignment makes pointer from integer without a cast [-Werror]
lang = gtk_source_language_manager_get_language (langm,"c");
   ^
cc1: all warnings being treated as errors
Makefile:31: recipe for target 'editor.o' failed
make: *** [editor.o] Error 1

这是我创造的功能,请有人帮助我

#include "editor.h"
#include <gtk/gtk.h>
#include <gtksourceview/gtksourceview.h>

ditor * editor_create(CSIde_app *app){
GtkSourceBuffer *buffer;
GtkSourceLanguage   *lang;
GtkSourceLanguageManager *langm;

Editor *editor  = (Editor*) g_slice_new(Editor);

editor->scrolled_window = gtk_scrolled_window_new (NULL,NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(editor->scrolled_window ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);

buffer  = gtk_source_buffer_new (NULL);
langm   = gtk_source_language_manager_new ();
lang    = gtk_source_language_manager_get_language (langm,"c");
editor->buffer = buffer;
editor->source_view = gtk_source_view_new_with_buffer (buffer);
gtk_source_view_set_auto_indent (GTK_SOURCE_VIEW(editor->source_view),TRUE);
gtk_source_view_set_show_line_numbers (GTK_SOURCE_VIEW(editor->source_view),TRUE);
gtk_source_buffer_set_language (buffer,lang);

gtk_container_add (GTK_CONTAINER(editor->scrolled_window),editor->source_view);

return editor;
}

问题是什么以及我如何解决它

0 个答案:

没有答案