This is an error report.
Screenshot of the error
Error details
Running into an error while compiling a C++ program.
This is an error report.
Screenshot of the error
Error details
Running into an error while compiling a C++ program.
Hi @coltonewestern,
the error indicates that you don’t have a function named main in your program.
Every C++ program needs a main function, which is the entry point for your program.
If you need further help, please share here the content of the file.cpp file that you are trying to compile.
Below we have an example of a file that is not going to compile because it has no function named main:
#include <iostream>
void aFunction() {
std::cout<<"I am a function \n";
}
Now, an example of a file that compiles:
#include <iostream>
void aFunction() {
std::cout<<"I am a function \n";
}
int main() {
aFunction();
return 0;
}
Thanks for the quick reply! I added a main function to my program and that worked perfectly. I thought I was able to compile before following the below instructions without a main function but I’m not sure how that would have been possible with the error I was getting.
Thank you for your help!
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.