c - 未定义的建筑符号 - 奇怪的消息

标签 c compiler-construction compiler-errors makefile

当我编译时,我收到一组奇怪的错误。 这是我首先编译的。 (这是从我的 makeFile 生成的。)

gcc -Wall -g -std=gnu99 -pedantic -c error.c -o error.o
gcc -Wall -g -std=gnu99 -pedantic -c agent.c -o agent.o
gcc -Wall -g -std=gnu99 -pedantic -c io.c -o io.o
gcc -Wall -g -std=gnu99 -pedantic -c map.c -o map.o

然后归结为将它们与我的处理程序链接在一起;我用这个:

gcc -Wall -g -std=gnu99 -pedantic error.o agent.o io.o map.o handler.c -o handler

它输出一条消息,我找不到相关信息。有什么想法吗?

Undefined symbols for architecture x86_64:
    "_m", referenced from:
    _print_map in io.o
    _read_map in io.o
    _check_row in map.o
    _get_start_pos in map.o
    _move_one_step in map.o
    _displayMoveOnMap in map.o
    _reset_map in map.o
    ...
    (maybe you meant: _reset_map, _move_one_step , _print_map , _read_map , _main )

我认为这只是 Makefile 的一个小调整,但我找不到太多关于这些错误的信息。

最佳答案

听起来你在 io.c 和 map.c 中都有一个 extern m (我不知道什么类型,或者即使它是一个函数),但没有定义它任何地方。我会在 map.h 中查找 extern 声明,尽管这只是一个猜测。

关于c - 未定义的建筑符号 - 奇怪的消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19039895/

相关文章:

c - C 头文件和库的分发和链接

c - 如何覆盖 A C 系统调用?

java - 初学者Java : Understanding error message: Exception in thread “main” java.util.NoSuchElementException

c# - NHibernate错误:s

java - 处理 Java 错误 : The nested type (Node) cannot hide an enclosing type

c - 将 XOR 作为宏实现,但未按预期工作

c - 如何获取在 Windows 上运行的 C 中可执行文件的路径?

c++ - PHP 的 isset() 在 C/C++ 中的对应物

java - 获取字符串 "asdxyz\n"并用 ascii 值替换\n

compiler-construction - 什么是编译器、链接器、加载器?