当我编译'''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工作正常
mpicc p35.c -o p35.out
现在运行 p35.out
档案
./p35.out
我想你能做到这一点。