I am a complete beginner in C++ and trying to run my first program.
#include <iostream>
int main()
{
std::cout << "Hello world!";
return 0;
}
Then I run, in the terminal:
g++ first.cpp
But it gives me this error:
/home/shikhar/anaconda3/bin/ld: /lib/x86_64-linux-gnu/libc.so.6: undefined reference to `_dl_exception_create@GLIBC_PRIVATE'
/home/shikhar/anaconda3/bin/ld: /lib/x86_64-linux-gnu/libc.so.6: undefined reference to `_dl_audit_symbind_alt@GLIBC_PRIVATE'
/home/shikhar/anaconda3/bin/ld: /lib/x86_64-linux-gnu/libc.so.6: undefined reference to `_dl_audit_preinit@GLIBC_PRIVATE'
/home/shikhar/anaconda3/bin/ld: /lib/x86_64-linux-gnu/libc.so.6: undefined reference to `_dl_find_dso_for_object@GLIBC_PRIVATE'
/home/shikhar/anaconda3/bin/ld: /lib/x86_64-linux-gnu/libc.so.6: undefined reference to `_dl_fatal_printf@GLIBC_PRIVATE'
/home/shikhar/anaconda3/bin/ld: /lib/x86_64-linux-gnu/libc.so.6: undefined reference to `__nptl_change_stack_perm@GLIBC_PRIVATE'
/home/shikhar/anaconda3/bin/ld: /lib/x86_64-linux-gnu/libc.so.6: undefined reference to `__tunable_get_val@GLIBC_PRIVATE'
I am using Linux Mint 21.2. \
I am unable to understand any solutions on the internet for similar errors.
The problem was using the compiler through anaconda. Deactivating anaconda then compiling worked.
conda deactivate