Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

COCALC c++ clang Errors

Whatever this means:

/WEEK1$ g++ hello.cpp /WEEK1$ clang hello.cpp /tmp/hello-e918fc.o: In function main': hello.cpp:(.text+0xa): undefined reference tostd::cout' hello.cpp:(.text+0x24): undefined reference to std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)' /tmp/hello-e918fc.o: In function__cxx_global_var_init': hello.cpp:(.text.startup+0x13): undefined reference to std::ios_base::Init::Init()' hello.cpp:(.text.startup+0x19): undefined reference tostd::ios_base::Init::~Init()' clang: error: linker command failed with exit code 1 (use -v to see invocation) ~/WEEK1$ g++ hello.cpp -o hello ~/WEEK1$ ./hello Hello World~/WEEK '

https://share.cocalc.com/share/a8d047c3-4121-4354-b7da-388cf1c70473/WEEK1/?viewer=share/

COCALC c++ clang Errors

Whatever this means:

/WEEK1$ g++  hello.cpp
/WEEK1$ clang hello.cpp
/tmp/hello-e918fc.o: In function main':
`main':
hello.cpp:(.text+0xa): undefined reference tostd::cout'
to `std::cout'
hello.cpp:(.text+0x24): undefined reference to std::basic_ostream<char, `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/tmp/hello-e918fc.o: In function__cxx_global_var_init':
function `__cxx_global_var_init':
hello.cpp:(.text.startup+0x13): undefined reference to std::ios_base::Init::Init()'
`std::ios_base::Init::Init()'
hello.cpp:(.text.startup+0x19): undefined reference tostd::ios_base::Init::~Init()'
to `std::ios_base::Init::~Init()'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
~/WEEK1$ g++  hello.cpp -o hello
~/WEEK1$ ./hello
Hello World~/WEEK '

'

https://share.cocalc.com/share/a8d047c3-4121-4354-b7da-388cf1c70473/WEEK1/?viewer=share/

COCALC c++ clang Errors

Whatever this means:

/WEEK1$ g++  hello.cpp
/WEEK1$ clang hello.cpp
/tmp/hello-e918fc.o: In function `main':
hello.cpp:(.text+0xa): undefined reference to `std::cout'
hello.cpp:(.text+0x24): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/tmp/hello-e918fc.o: In function `__cxx_global_var_init':
hello.cpp:(.text.startup+0x13): undefined reference to `std::ios_base::Init::Init()'
hello.cpp:(.text.startup+0x19): undefined reference to `std::ios_base::Init::~Init()'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
~/WEEK1$ g++  hello.cpp -o hello
~/WEEK1$ ./hello
Hello World~/WEEK '

g++ complier works clang compiler not

https://share.cocalc.com/share/a8d047c3-4121-4354-b7da-388cf1c70473/WEEK1/?viewer=share/