gcc生成.o文件而不是可执行文件

时间:2016-10-13 17:18:19

标签: c ubuntu gcc

我试图调试claws-mail通知插件,我有这样的代码:

#include "notification_indicator.h"
#include "notification_prefs.h"
#include "notification_core.h"

#include "folder.h"
#include "common/utils.h"

#include <messaging-menu.h>
#include <unity.h>

#define CLAWS_DESKTOP_FILE "claws-mail.desktop"

#include <stdio.h>

void main(void)
{
  GList *cur_mb;
  gint total_message_count;


  total_message_count = 0;
  /* check accounts for new/unread counts */
  for(cur_mb = folder_get_list(); cur_mb; cur_mb = cur_mb->next) {
    Folder *folder = cur_mb->data;
    NotificationMsgCount count;

    if(!folder->name) {
      printf("Notification plugin: Warning: Ignoring unnamed mailbox in indicator applet\n");
      continue;
    }
    gchar *id = folder->name;
    notification_core_get_msg_count_of_foldername(folder->name, &count);
    printf("%s: %d\n", folder->name, count.unread_msgs);
  }
}

我正在用这个命令编译它:

gcc  -I/home/kuba/Pobrane/claws-mail-3.13.2/src/
     -I/usr/include/gtk-2.0/
     -I/usr/include/cairo/
     -I/usr/include/pango-1.0
     -I/usr/lib/i386-linux-gnu/gtk-2.0/include/
     -I/usr/include/gdk-pixbuf-2.0/
     -I/usr/include/atk-1.0/
     -I/home/kuba/Pobrane/claws-mail-3.13.2/src/common
     -I/home/kuba/Pobrane/claws-mail-3.13.2/src/gtk
     -I/usr/include/messaging-menu/
     -I/usr/include/unity/unity/
     -I/usr/include/dee-1.0/
     -I/usr/include/libdbusmenu-glib-0.4/
     -c `pkg-config --cflags glib-2.0` test.c

但gcc创建对象文件test.o而不是a.out如何创建可执行文件?我在Xubuntu上运行它。

1 个答案:

答案 0 :(得分:1)

从命令行中删除-c选项(生成目标文件而不是可执行文件)。

来自man gcc

  

-c
  编译或汇编源文件,但不要链接。链接阶段根本没有完成。最终的输出是在形式   每个源文件的目标文件。