我是新的clang和llvm和这个邮件论坛。我正在我的windows 32位系统上尝试使用“mingw32版本2.9的cland二进制文件”和“mingw32版本2.9的llvm二进制文件”来构建cland。我遵循以下步骤:
在目录(C:/MinGW)
#include
int main()
{
printf(“你好世界\n”);
返回0;
}
然后编译代码
clang hello.cpp -o hello.exe
它编译得很好
但当我试图执行它时
clang hello.exe it gives following error **************ERROR__**************
hello.exe:crt1.c:(.text+0x280):在这里定义的mainCRTStartup' c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../crt2.o:crt1.c:(.text+0x280): firs t defined here hello.exe:crt1.c:(.text+0x2a0): multiple definition ofWinMainCRTStartup的多个定义c:/mingw/bin/../lib/gcc/mingw32/4.6.2/crtbegin.o:cygming-crtbegin.c:(.text+0x8c):.o:crt1.c:(.text+0x2d0):第一次定义在这里--hello.exe:cygming-crt1.c.c:(.text+0x2e0):__gcc_regist er_frame' c:/mingw/bin/../lib/gcc/mingw32/4.6.2/crtbegin.o:cygming-crtbegin.c:(.text+0x0): first defined here hello.exe:cygming-crtbegin.c:(.text+0x36c): multiple definition of_gcc_deregi ster_frame‘ster_frame的多个定义:在这里首次定义: hello.exe:crt1.c:(.bss+0x4):_argc' c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../crt2.o:crt1.c:(.bss+0x4): first d efined here hello.exe:crt1.c:(.bss+0x0): multiple definition of_argv’c的多个定义:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../crt2.o:crt1.c:(.bss+0x0):首先在这里定义了c:/mingw/bin/../lib/gcc/mingw32/4.6.2/crtbegin.o:cygming-crtbegin.c:(.text+0x85):对`_Jv_RegisterClasses‘collect2的未定义引用: ld返回了一个退出状态clang: error: linker (通过gcc)命令失败退出代码1(使用*******************E179<查看调用)/code>**********]
我如何解决这个问题?
发布于 2012-03-29 15:47:04
这里有一个链接,指向如何从Windows上的源代码编译Clang,本文讨论了Objective和Clang在Windows上-您可以安全地忽略这一点,并使用所描述的技术来构建Clang。生成的编译器将编译您的C++代码,没有问题。或者,您也可以下载作者编译的Clang 3.1:
http://solarianprogrammer.com/2012/03/21/clang-objective-c-windows/
https://stackoverflow.com/questions/9900547
复制相似问题