【发布时间】:2015-09-17 23:43:17
【问题描述】:
今天我为 C 安装了 Allegro 游戏编程库,并尝试包含其中一个头文件,但是当我尝试在终端中执行 gcc -I./include example.c -o a.exe 时,我不断收到此错误:
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
(maybe you meant: __al_mangled_main)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
有什么想法吗?我使用此处的说明安装了 Allegro 5:https://wiki.allegro.cc/index.php?title=Install_Allegro5_From_GIT/OSX
example.c 代码:
#include <stdio.h>
#include <allegro5/allegro.h>
int main(int argc, const char *argv[]){
puts(“Hello, world!”);
return 0;
}
【问题讨论】:
-
为什么是
*argvconst? -
@Navin:如果你愿意,你可以
const它。没有人可以强迫你修改你的参数向量。 -
@EOF 我只是好奇,因为这不是通常的签名。