小编adi*_*adi的帖子

如何在C中链接目标文件?失败"为架构x86_64定义未定义的符号"

所以我正在尝试使用我文件(file2.c)中另一个C(file1.c)文件中定义的函数.我要包含file1(file1.h)的头文件才能执行此操作.

但是,每当我尝试使用gcc编译文件时,我都会收到以下错误:

Undefined symbols for architecture x86_64:
  "_init_filenames", referenced from:
      _run_worker in cc8hoqCM.o
  "_read_list", referenced from:
      _run_worker in cc8hoqCM.o
ld: symbol(s) not found for architecture x86_64
Run Code Online (Sandbox Code Playgroud)

我被告知我需要"将目标文件链接在一起"才能使用file2中file1的功能,但我不知道这意味着什么:(

c gcc compilation

48
推荐指数
5
解决办法
11万
查看次数

标签 统计

c ×1

compilation ×1

gcc ×1