Articles on: Course

Why do I get a Compile Error?

Articles on: Courses

There are a few reasons why your code may compile on your computer.In all cases, you can see the compile error by clicking on the Compile Error icon after submitting your code.
Java:
Your class containing the main method must be a public class called Main. It may not be called anything else. Do not use packages.
C/C++:
Make sure you are using a compiler that complies with the standards. Turbo C++ is not such a compiler, and often code which compiles in Turbo C++ will not compile on platform.
Make sure you are using standard headers. Do not use conio.h in C; this is not part of the C standard library. Do not use iostream.h; this is a deprecated header file and again is not a standard library. (You should just be using iostream instead).
The flags used for C++ are: g++ -pipe -O2 -lm -s -fomit-frame-pointer

Updated on: 12/10/2021

Updated on: 21/09/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!