[cfe-dev] Linking errors on combining Clang compiler and Visual Studio 2010 linker

Агафонов Александр agalexl at mail.ru
Sat Apr 16 02:16:01 PDT 2011


I've successfully build Clang compiler on Windows and successfully 
compiled a simple pure C hello world application. But when I've tried to 
compile the following simple C++ application I got a bunch of linking 
errors from Visual Studio 2010 linker.

The content of "sample.cpp":

    #include <vector>

    int main() {
         std::vector<int> v;
         v.push_back( 0 );
         return v.front();
    }

Then I've typed in the Visual Studio 2010 command line:

    clang sample.cpp -o sample.exe -v

And I've got this:

    clang version 3.0 (trunk)
    Target: i686-pc-win32
    Thread model: posix
      "C:/Development/Clang/build/bin/Release/clang.exe" -cc1 -triple
    i686-pc-win32 -
    emit-obj -mrelax-all -disable-free -disable-llvm-verifier
    -main-file-name sample
    .cpp -mrelocation-model static -mdisable-fp-elim -masm-verbose
    -mconstructor-ali
    ases -momit-leaf-frame-pointer -v -resource-dir
    C:/Development/Clang/build/bin/R
    elease\..\lib\clang\3.0 -ferror-limit 19 -fmessage-length 80
    -fcxx-exceptions -f
    exceptions -fms-extensions -fmsc-version=1300 -fgnu-runtime
    -fdiagnostics-show-o
    ption -fcolor-diagnostics -o
    C:/DOCUME~1/Lokken/LOCALS~1/Temp/cc-633218.o -x c++
      sample.cpp
    clang -cc1 version 3.0 based upon llvm 3.0 hosted on i686-pc-win32
    ignoring nonexistent directory "/usr/local/include"
    ignoring nonexistent directory
    "C:/Development/Clang/build/bin/Release/../lib/cl
    ang/3.0/include"
    ignoring nonexistent directory "C:\Program Files\Microsoft Visual
    Studio 10.0\VC
    \PlatformSDK\Include"
    ignoring nonexistent directory "/usr/include"
    #include "..." search starts here:
    #include <...> search starts here:
      C:\Program Files\Microsoft Visual Studio 10.0\VC\include
    End of search list.
      "C:/Program Files/Microsoft Visual Studio 10.0/VC/BIN/link.exe"
    -out:sample.exe
      -defaultlib:libcmt -nologo
    C:/DOCUME~1/Lokken/LOCALS~1/Temp/cc-633218.o
    cc-633218.o : error LNK2019: unresolved external symbol
    __ZSt14_Xlength_errorPKc
      referenced in function __ZNKSt6vectorIiSaIiEE5_XlenEv
    cc-633218.o : error LNK2019: unresolved external symbol __ZdlPv
    referenced in fu
    nction __ZNSaIiE10deallocateEPij
    cc-633218.o : error LNK2019: unresolved external symbol __Znwj
    referenced in fun
    ction __ZSt9_AllocateIiEPT_jS1_
    cc-633218.o : error LNK2019: unresolved external symbol
    ___cxa_allocate_exceptio
    n referenced in function __ZSt9_AllocateIiEPT_jS1_
    cc-633218.o : error LNK2019: unresolved external symbol ___cxa_throw
    referenced
    in function __ZSt9_AllocateIiEPT_jS1_
    cc-633218.o : error LNK2019: unresolved external symbol
    __ZNSt9exceptionD2Ev ref
    erenced in function __ZNSt9bad_allocD2Ev
    cc-633218.o : error LNK2019: unresolved external symbol
    __ZNSt9exceptionC2ERKPKc
      referenced in function __ZNSt9bad_allocC2EPKc
    cc-633218.o : error LNK2001: unresolved external symbol
    __ZTVN10__cxxabiv120__si
    _class_type_infoE
    cc-633218.o : error LNK2001: unresolved external symbol
    __ZTISt9exception
    cc-633218.o : error LNK2001: unresolved external symbol
    __ZNKSt9exception4whatEv

Is this a bug or am I doing something wrong?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110416/47a555c3/attachment.html>


More information about the cfe-dev mailing list