My C++ Repl is not working. Displaying "clang 12 error". Please help

My replit code suddenly stopped working. It is showing the following error:
e.o:/home/runner/Sample/./2Ifelse.cpp:4: first defined here
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:10: main] Error 1
exit status 2

Please help me with it. :-/

Can you share the code?

You have no main file, please move what you would consider your “main” runner code to a file named main.cpp

EDIT: this is not the case, actually, c++ is an OOP lang so it’s actually that you have multiple instances of int main in two different files

to fix this: merely delete one of the instances.

In c++, your “main” code will be run in the int main function, and everything else should be classes :smiley:

you have a main function in both files. Use a different repl for each project, or run in shell, e.g.:

clang BasicsInfo.cpp -o BasicsInfo
1 Like