我正在尝试使用gcc在linux终端上从多个C源文件创建一个可执行文件。我设法创建了目标文件,但是可执行文件没有显示。这就是我在终端中运行的内容:
gcc -Wall -c commandLine.c main.c commandLine.h
以上创建目标文件。
gcc commandLine.o main.o -o executable
以上内容应该创建可执行文件,但是我的目录中没有可执行文件。然后在终端中打印以下内容:
/usr/bin/ld: warning: cannot find entry symbol xecutable; defaulting to 0000000000001740
main.o: In function `main':
main.c:(.text+0x2897): undefined reference to `CreateVariable'
collect2: error: ld returned 1 exit status
在文件上添加chmod 777,然后进行编译。
gcc yourfile_name
./ a.out