So I’m trying to complete the first Hello World exercise in C++…I entered the following code:
#include
int main() {
std::cout << “Hello World”;
return 0;
}
However when clicking the “Run Tests” button, I get the following error:
We received the following error when we ran your code:
/usr/lib/gcc/x86_64-alpine-linux-musl/9.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/local/lib64/libCatch2WithMain.a(catch_with_main.cpp.o): in function `main':
catch_with_main.cpp:(.text+0x29535): multiple definition of `main'; CMakeFiles/hello-world.dir/hello_world.cpp.o:/tmp/hello-world/hello_world.cpp:3: first defined here
/usr/lib/gcc/x86_64-alpine-linux-musl/9.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: CMakeFiles/hello-world.dir/hello_world_test.cpp.o: in function `____C_A_T_C_H____T_E_S_T____0()':
/tmp/hello-world/hello_world_test.cpp:15: undefined reference to `hello_world::hello[abi:cxx11]()'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/hello-world.dir/build.make:100: hello-world] Error 1
make[1]: *** [CMakeFiles/Makefile2:77: CMakeFiles/hello-world.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
What’s going on??