-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Linker errors on "Hello, world!" in Windows #11777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
d:\dev\test> clang++ foo.cpp -Xclang -cxx-abi -Xclang microsoft
Can't yet mangle constructors!
UNREACHABLE executed at D:\dev\tools\llvm\tools\clang\lib\AST\MicrosoftMangle.cpp:1172!
clang++: error: clang frontend command failed with exit code 3 (use -v to see invocation)
d:\dev\test> _ |
OS: Windows 7 |
You'll need some kind of C++ standard library (e.g., the mingw libstdc++) to make this work. The Microsoft ABI is not yet implemented. Not a release blocker. |
C:\LLVM\build\bin\Debug>clang -fno-rtti -Xclang -cxx-abi -Xclang microsoft hello1.cpp Tested with trunk, fails on r-value reference mangling in MS ABI. |
*** Bug llvm/llvm-bugzilla-archive#12336 has been marked as a duplicate of this bug. *** |
As of r158895 and with the nullptr_t stddef.h patch in the mailing list, this reaches code generation, though it crashes in there. C:\LLVM\build\bin\Debug>clang++ -fno-rtti -Xclang -cxx-abi -Xclang microsoft -c 11405.cpp
Stack: |
By the way, this also fails in non-MS ABI because it tries to link with the MS C standard library while generating Itanium mangled names. We should just error out in that case, since with the MS library headers it will never work. |
Following the steps described at http://llvm.org/docs/GettingStartedVS.html fails in step 6 with two unresolved externals: C:\Program Files (x86)\Microsoft Visual Studio 11.0>link -defaultlib:libcmt -out hello_world.obj : error LNK2019: unresolved external symbol printf referenced in |
There seem to be a few issues here:
Today there are no more link errors with iostream hello world and the MSVCRT. There are errors about intrin.h which are outstanding, but if I hack around it locally I can get the following to work: $ ls intrin.h $ cat hello.cpp $ clang -fmsc-version=1700 -isystem . -msse4a -D_HAS_EXCEPTIONS=0 -fno-rtti -fno-exceptions -Xclang -cxx-abi -Xclang microsoft hello.cpp && ./a.out We already have issues open about supporting Microsoft intrinsics and resolving these issues, so I don't see a need to keep this open: |
mentioned in issue llvm/llvm-bugzilla-archive#12336 |
mentioned in issue llvm/llvm-bugzilla-archive#12477 |
Extended Description
After downloading the current source, and building the compiler etc. using Visual C++ 10.0, it errs out on "Hello, world!" with various linker errors.
Providing some options that reportedly could help, the compiler crashed (ICE, it
called abort()).
See also my posting <url: http://stackoverflow.com/questions/8194375/clang-hello-world-link-errors-in-windows>
d:\dev\test> type con >foo.cpp #include using namespace std; int main() { cout << "Hello, cling-clong world!" << endl; } ^Zd:\dev\test> clang++ foo.cpp
foo-839435.o : error LNK2019: unresolved external symbol __ZSt4cout referenced in function _main
foo-839435.o : error LNK2019: unresolved external symbol __ZdlPv referenced in function __ZNSt14error_categoryD0Ev
foo-839435.o : error LNK2019: unresolved external symbol __ZSt18uncaught_exceptionv referenced in function __ZNSo6sentry
D2Ev
foo-839435.o : error LNK2019: unresolved external symbol ___cxa_rethrow referenced in function __ZNSt8ios_base5clearEib
foo-839435.o : error LNK2019: unresolved external symbol ___cxa_allocate_exception referenced in function __ZNSt8ios_base5clearEib
foo-839435.o : error LNK2019: unresolved external symbol ___cxa_throw referenced in function __ZNSt8ios_base5clearEib
foo-839435.o : error LNK2019: unresolved external symbol __ZSt17iostream_categoryv referenced in function __ZSt15make_er
The text was updated successfully, but these errors were encountered: