Archlinux:无法安装vpcs - 错误:'getopt'的冲突类型

时间:2017-09-27 15:18:33

标签: gcc archlinux

我正在尝试在Archlinux中安装vpcs(GNS3需要)但在运行makepkg命令后出现以下错误:

**In file included from hv.c:45:0:
./getopt.h:53:5: error: conflicting types for ‘getopt’
 int getopt(int argc, char** argv, char* optstr);
     ^~~~~~**
In file included from /usr/include/bits/getopt_posix.h:27:0,
                 from /usr/include/unistd.h:872,
                 from hv.c:33:
/usr/include/bits/getopt_core.h:91:12: note: previous declaration of ‘getopt’ was here
 extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
            ^~~~~~
make: *** [Makefile.linux:38: hv.o] Error 1
==> ERROR: A failure occurred in build().
    Aborting...

试图谷歌问题 - 没有运气。有什么帮助吗?

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,但终于解决了。

$ sudo pacman -S subversion
$ cd /tmp
$ svn checkout svn://svn.code.sf.net/p/vpcs/code/trunk vpcs-code
$ cd vpcs-code/src
$ rgetopt='int getopt(int argc, char *const *argv, const char *optstr);'
$ sed -i "s/^int getopt.*/$rgetopt/" getopt.h
$ unset -v rgetopt
$ sed -i 's/i386/x86_64/' Makefile.linux
$ sed -i 's/-s -static//' Makefile.linux
$ make -f Makefile.linux
$ strip --strip-unneeded vpcs
$ sudo mv vpcs /usr/local/bin

Source