I am just learning how to code.
I have installed clang version 5 on a windows 10 system using visual studio 14.
I created a hello world cpp file to test that is working.
Sample code
#include <iostream> using namespace std; int main() { cout << "Hello World!\n"; int rip{1}; int dal{4}; int kane = rip + dal; cout << kane; return 0; }
command
clang++ -o .\bin\testing.exe test.cpp
Clang does compile and I get an executable which does run as expected. however I do receive this message.
test-3e53b3.o : warning LNK4217: locally defined symbol ___std_terminate imported in function "int `public: __thiscall std::basic_ostream<char,struct std::char_traits<char> >::sentry::~sentry(void)'::`1'::dtor$5" (?dtor$5@?0???1sentry@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@XZ@4HA) test-3e53b3.o : warning LNK4217: locally defined symbol __CxxThrowException@8 imported in function "public: void __thiscall std::ios_base::clear(int,bool)" (?clear@ios_base@std@@QAEXH_N@Z)
I have searched online and can find similar issues but they are not the same.
I realise this maybe simple to you guys, but I am at a loss I have used various IDES and GCC and this code has not produced this warning before.
Add -Xclang -flto-visibility-public-std to your compiler options.
Like so:
clang++ -Xclang -flto-visibility-public-std -o test.exe test.cpp
Edit:
Or use clang-cl instead:
clang-cl -o test.exe test.cpp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With