Errors:
**** Build of configuration Default for project hello ****
make all arm-none-linux-gnueabi-gcc hello.o -o hello hello.o: In function 'main': /home/Gabriel/DS-5-Workspace/hello/hello.c:22: undefined reference to 'gtk_init' /home/Gabriel/DS-5-Workspace/hello/hello.c:23: undefined reference to 'gtk_window_new' /home/Gabriel/DS-5-Workspace/hello/hello.c:24: undefined reference to 'gtk_window_get_type' /home/Gabriel/DS-5-Workspace/hello/hello.c:24: undefined reference to 'g_type_check_instance_cast' /home/Gabriel/DS-5-Workspace/hello/hello.c:24: undefined reference to 'gtk_window_set_title' /home/Gabriel/DS-5-Workspace/hello/hello.c:25: undefined reference to 'gtk_widget_show' /home/Gabriel/DS-5-Workspace/hello/hello.c:26: undefined reference to 'gtk_main' collect2: ld returned 1 exit status make: *** [hello] Error 1
My makefile (original project Hello):
# C Application Example for ARM Linux # # Copyright (C) ARM Limited, 2007-2010. All rights reserved.
# This makefile is intended for use with GNU make # # This project can be built with either armcc or gcc by setting: # TOOLCHAIN = armcc # or # TOOLCHAIN = gcc
TOOLCHAIN = gcc
TARGET = hello CPU = -march=armv5te CC_OPTS = -c -O1 -g \ -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/gtk-2.0 \ -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/glib-2.0 \ -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/glib-2.0/include \ -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/cairo \ -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/pango-1.0 \ -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/gtk-2.0/include \ -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/atk-1.0 \ -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib \ -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/glib-2.0/include \ -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/gtk-2.0/include
OBJS = hello.o STRIPPED_DIR = stripped
##########################################################################
ifeq ($(strip $(TOOLCHAIN)),armcc) CONFIG_FILE = arm_linux_config.xml CPP = armcc --cpp --arm_linux_paths --arm_linux_config_file=$(CONFIG_FILE) --translate_g++ CC = armcc --arm_linux_paths --arm_linux_config_file=$(CONFIG_FILE) --translate_gcc AR = armar STRIP_APP = fromelf --strip debug,comment,symbols --elf STRIP_LIB = fromelf --strip debug,comment,symbols --elf else CONFIG_FILE = CPP = arm-none-linux-gnueabi-c++ CC = arm-none-linux-gnueabi-gcc AR = arm-none-linux-gnueabi-ar STRIP_APP = arm-none-linux-gnueabi-strip -R .comment --strip-all STRIP_LIB = arm-none-linux-gnueabi-strip -R .comment --strip-unneeded endif
# Select build rules based on Windows or Linux ifdef WINDIR WINPATH=$(subst /,\,$(1)) DONE=@if exist $(call WINPATH,$(1)) echo Build completed. define REAL_RM if exist $(call WINPATH,$(1)) del /q $(call WINPATH,$(1))
endef RM=$(foreach file,$(1),$(call REAL_RM,$(file))) SHELL=$(windir)\system32\cmd.exe MD=if not exist $(1) mkdir $(1) CP=copy else ifdef windir WINPATH=$(subst /,\,$(1)) DONE=@if exist $(call WINPATH,$(1)) echo Build completed. define REAL_RM if exist $(call WINPATH,$(1)) del /q $(call WINPATH,$(1))
endef RM=$(foreach file,$(1),$(call REAL_RM,$(file))) SHELL=$(windir)\system32\cmd.exe MD=if not exist $(1) mkdir $(1) CP=copy
else DONE=@if [ -f $(1) ]; then echo Build completed.; fi RM=rm -f $(1) MD=@if [ ! -d $(1) ]; then mkdir $(1); fi CP=cp endif endif
all: $(TARGET) $(call DONE,$(TARGET))
rebuild: clean all
clean: $(call RM,$(CONFIG_FILE)) $(call RM,$(OBJS)) $(call RM,$(TARGET)) $(call RM,$(STRIPPED_DIR)/$(TARGET))
# Create the configuration file so that the ARM compiler can find the GCC headers and libraries $(CONFIG_FILE): armcc --arm_linux_configure --arm_linux_config_file=$(CONFIG_FILE)
# Compile the sources $(OBJS): %.o: %.c $(CONFIG_FILE) $(CC) $(CPU) $(CC_OPTS) $< -o $@
# Link the objects together to create an executable # Strip the host/debug version to create a stripped/nodebug version for downloading to the target $(TARGET): $(OBJS) $(CONFIG_FILE) $(call MD,$(STRIPPED_DIR)) $(CC) $(OBJS) -o $(TARGET) $(STRIP_APP) $(TARGET) -o $(STRIPPED_DIR)/$(TARGET)
My small program:
#include <stdio.h> #include <gtk/gtk.h>
//int main(int argc, char** argv) //{ // printf("Hello world\n"); //} int main(int argc, char **argv) {
GtkWidget *janela; gtk_init(&argc, &argv); janela = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW (janela), "Alo Mundo"); gtk_widget_show(janela); gtk_main(); return 0;
}
Can anyone help?