Why is this error message appearing?
From the last few days, I was trying to run a C++ program but the error is showing. I don't understand why. I changed the compiler settings after seeing a YouTube video. It was working until the file name was Main.cpp
and when in the next program I gave another name it started showing the error. I do not understand how to read the error messages.
#include <iostream> //iostream allow us to load pre-built libraries.int main() // main function. Function in c++ is a block of code that does many things.{ std::cout << "Hello World ! This is my first C++ project" << std:: endl; std::cout << "This is Anish Sharma"; return 0;}
Terminal -> Run Task... -> GCC compiler.
Then comes the error message:
* Executing task: Build with GCC compiler 14.2, released [1.8.2024]Starting build...cmd /c chcp 65001>nul && C:\mingw64\bin\g++.exe -g -std=c++2b C:\Users\ANISH\Documents\CPP\*.cpp -o C:\Users\ANISH\Documents\CPP\rooster.exeC:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\ANISH\AppData\Local\Temp\ccME9uEU.o: in function `main':C:/Users/ANISH/Documents/CPP/new.cpp:3: multiple definition of `main'; C:\Users\ANISH\AppData\Local\Temp\cce2cCLP.o:C:/Users/ANISH/Documents/CPP/main.cpp:2: first defined hereC:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\ANISH\AppData\Local\Temp\ccup70G8.o: in function `main':C:/Users/ANISH/Documents/CPP/numbersprinting.cpp:4: multiple definition of `main'; C:\Users\ANISH\AppData\Local\Temp\cce2cCLP.o:C:/Users/ANISH/Documents/CPP/main.cpp:2: first defined herecollect2.exe: error: ld returned 1 exit statusBuild finished with error(s).* The terminal process terminated with exit code: -1.* Terminal will be reused by tasks, press any key to close it.