mingw32上的叮当声的链接器错误

问题描述:

我是clang和llvm以及此邮件论坛的新成员。我正在使用“用于mingw32版本2.9的cland二进制文件”和“用于mingw32版本2.9的llvm二进制文件”在windows xp 32位系统上构建cland。我遵循以下步骤:mingw32上的叮当声的链接器错误

  1. 下载MinGW的目录(C:/ MinGW的)
  2. 下载 “clang2.9二进制文件的mingw32” 和 “LLVM-2.9二进制文件的mingw32” 都在同一个
  3. 提取物mingw目录(C:/ MinGW)
  4. 设置路径C:/ MinGW/bin为PATH环境。 然后我写一个简单的代码

    的#include
    INT主()
    {
    的printf( “世界你好\ n”);
    return 0;
    }

然后编译代码

铛HELLO.CPP -o用hello.exe
它编译罚款
但是当我试图执行它
铛用hello.exe 它提供了以下错误

** * ** * ** * ** * **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 of WinMainCRTStartup' c:/ mingw/bin /../ lib/gcc/mingw32/4.6.2 /../../ .. /crt2.o:crt1.c:(.text+0x2a0):firs t这里定义 hello.exe:crt1.c :(。text + 0x2c0):多重定义atexit' c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../crt2.o:crt1.c:(.text+0x2c0): firs t defined here hello.exe:crt1.c:(.text+0x2d0): multiple definition ofonexit' c:/ mingw/bin /../ lib/gcc/mingw32/4.6.2 /../。 ./../crt2.o:crt1.c:(.text+0x2d0):冷杉 吨这里定义 用hello.exe:cygming-crtbegin.c :(文本+ 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' c:/ mingw/bin /../ lib/gcc/mingw32/4.6.2/crtbegin.o:cygming-crtbegin.c :(.text + 0x8c) :此处首先定义 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):首先d 在这里定义 c:/ mingw/bin /../ lib/gcc/mingw32/4.6.2/crtbegin.o:cygming-crtbegin.c :(。文本+ 0x85) :未定义参考`_Jv_RegisterClasses' collect2:LD返回1退出状态 铛:错误: 接头 (经由 GCC) 命令 与 出口 代码失败 (使用 - v 到 看到 调用) * ** * ** * ** * ** * ** * ** * ** * ** * ** * *]
我怎样才能解决这个问题呢?

这里是一个链接,指出如何从Windows上的源代码编译Clang,本文将介绍Windows上的Objective-C和Clang,您可以放心地忽略它,并使用描述的技术来构建Clang。由此产生的编译器将毫无问题地编译你的C++代码。或者你可以下载作者的编译铿锵3.1:

http://solarianprogrammer.com/2012/03/21/clang-objective-c-windows/