我在用mpicc编译时遇到了一个技术问题。

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

当我编译'''gcc'''时,我的gcc工作正常,但我试图用'''mpicc'''编译一个C程序,我的终端机返回这个错误,这也删除了脚本。

/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status

编译指令是: mpicc -o p35.c.

我如何解决这个问题?

我的gcc版本。

gcc --version
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

我的mpicc版本

mpicc --version
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

谢谢,我编译'''gcc'''时,我的gcc工作正常

linux gcc compiler-errors mpi ubuntu-18.04
1个回答
0
投票

编译命令错误

mpicc p35.c -o p35.out

现在运行 p35.out 档案

./p35.out

我想你能做到这一点。

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