Archlinux出现 cant install vpcs - error: conflicting types for ‘getopt’应该怎么解决?

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (1)
  • 关注 (0)
  • 查看 (153)

我试图在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...
提问于
用户回答回答于
$ 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

所属标签

可能回答问题的人

  • 腾讯云数据库 TencentDB

    腾讯云 · 产品团队 (已认证)

    304 粉丝2 提问51 回答
  • EatRice

    17 粉丝0 提问187 回答
  • 华讯云

    1 粉丝0 提问156 回答
  • 最爱开车啦

    9 粉丝503 提问1.7K 回答

扫码关注云+社区

领取腾讯云代金券