Makefile help error code in C++ coding

I need help for the Makefile to use C++ in order for my code to work. Its giving me this error Programming class - Replit

Repl link:
Programming class - Replit

code snippet

Is there a “duplicate symbol” error? If yes, consider deleting the other C++ files besides main.cpp.

Basically, the compiled chunks of C++ code are put together into your program by another program. This linker program usually expects anything with a name (variable, function, struct, class) in those chunks to be defined once. There are exceptions to this rule, but no worries about it. :slight_smile:

Main file:

#include <iostream>

int main() {
  // only define this function one time
  std::cout << "Hello world!\n";
}

File 2 (will confuse the “linker”):

#include <iostream>

int main() {
  std::cout << "I'm an extra definition >:) \n";
}

Hope this helps!