gcc不会在linux终端上创建可执行文件

问题描述 投票:1回答:1

我正在尝试使用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
c linux gcc executable
1个回答
0
投票

在文件上添加chmod 777,然后进行编译。

gcc yourfile_name

./ a.out

© www.soinside.com 2019 - 2024. All rights reserved.