[cfe-dev] Weird linking problem on Windows

İsmail Dönmez ismail at donmez.ws
Wed Feb 18 00:53:27 PST 2015


This looks related to r229241. Thanks to Aaron Ballman for the tip.

On Tue, Feb 17, 2015 at 8:20 PM, İsmail Dönmez <ismail at donmez.ws> wrote:
> Sent to wrong list :/
>
>
> ---------- Forwarded message ----------
> From: İsmail Dönmez <ismail at donmez.ws>
> Date: Tue, Feb 17, 2015 at 5:59 PM
> Subject: Weird linking problem on Windows
> To: "cfe-commits at cs.uiuc.edu" <cfe-commits at cs.uiuc.edu>
>
>
> This is a possible regression:
>
> [~]> clang++ -std=c++14 -D_HAS_EXCEPTIONS=0 auto_ptr.cpp
> auto_ptr-556ebb.o : error LNK2019: unresolved external symbol "void
> __cdecl operator delete(void *,unsigned __int64)" (??3 at YAXPEAX_K@Z)
> referenced in function main
> auto_ptr-556ebb.o : error LNK2019: unresolved external symbol
> __cxa_call_unexpected referenced in function "public: __cdecl
> std::basic_ostream<char,struct std::char_traits<char>
>>::sentry::~sentry(void)"
> (??1sentry@?$basic_ostream at DU?$char_traits at D@std@@@std@@QEAA at XZ)
> a.exe : fatal error LNK1120: 2 unresolved externals
> clang++.exe: error: linker command failed with exit code 1120 (use -v
> to see invocation)
>
> [~]> clang++ -v
> clang version 3.7.0 (http://llvm.org/git/clang.git
> d9d3dee4581c591ac65c759df275139ddd4cfa0c)
> (http://llvm.org/git/llvm.git
> 2a43652f3b8a97e67251d80a749d5227667ff5b1)
> Target: x86_64-pc-windows-msvc
> Thread model: posix
>
> [~]> cat auto_ptr.cpp
> #include <memory>
> #include <iostream>
>
> class Foo {
> public:
>     Foo(){};
>     ~Foo() { std::cout << "Destructor called." << std::endl; };
>
>     void echo() { std::cout << "Echo!" << std::endl; };
> };
>
> int main()
> {
>     std::auto_ptr<Foo> foo(new Foo);
>     foo->echo();
>
>     std::auto_ptr<Foo> bar(foo);
>
>     bar->echo();
>     return 0;
> }
>
> If I drop -std=c++14 then the delete symbol works:
>
> [~]> clang++ -D_HAS_EXCEPTIONS=0 auto_ptr.cpp
> auto_ptr-64308e.o : error LNK2019: unresolved external symbol
> __cxa_call_unexpected referenced in function "public: __cdecl
> std::basic_ostream<char,struct std::char_traits<char>
>>::sentry::~sentry(void)"
> (??1sentry@?$basic_ostream at DU?$char_traits at D@std@@@std@@QEAA at XZ)
> a.exe : fatal error LNK1120: 1 unresolved externals
> clang++.exe: error: linker command failed with exit code 1120 (use -v
> to see invocation)
>
> Also, clang-cl works fine.




More information about the cfe-dev mailing list