My code compiles on my machine, however, it gets compilation error on CodeChef why so?
There are a few reasons why your code may compile on your computer but not on Codechef. 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 CodeChef.
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
Other languages:
As with C/C++, make sure you are using a standard compiler/interpreter. The exact ones that Codechef uses are listed next to the language when submitting the program.
Read the sample solutions page to see an example of code which compiles and correctly solves the TEST program as a starting point.
Read the sample solutions page to see an example of code which compiles and correctly solves the TEST program as a starting point.
if turbo compiler is not such compiler than which compiler should i use?
watch on you tube how to submit a program on codechef,then you will find out solution of your problem.
code chef uses certain set of compiler for assessment…
try to use the same on your machine…
there is difference between how you write code in turbo c++ and gcc compiler
instead of conio.h which library should i use???
while submitting the code … we are getting wrong answer as an error even though it is compiling and giving the output in the codechef compiler.
Well Basically Compilation Error Occurs When You Dont Follow The Syntax Which Is Used While Coding
Like Skipping The ‘;’ or forgetting to close the } or if u make the incorrect for construct and many more times.
Also Do Check If You Have Selected The Correct Language In The Submission Page As Sometimes In A Hurry We Often Chose The Wrong Language.
prog.c:2:18: fatal error: conio.h: No such file or directory
#include < conio.h >
compilation terminated
I encountered the above compilation error… Whats the problem?
@depanshushani , don’t use it at all. Use only <stdio.h>. Codechef doesn’t use Turbo C compiler.
@kunnu27
I use CodeBlocks. It is Best. You can download it and code here.
And I suggest you to code on codechef online IDE.
My code works fine on codeblocks and codechef IDE still I get compile time error. Can someone help me out.
My code works fine on codeblocks and codechef IDE still I get compile time error. Can someone help me out.
If code blocks is such a compiler ?
My programs ran successfully in code blocks .
conio.h is not used in my program .
Time doesn’t exceeded .
In codeblocks my program gave right output .
Then why my answer is shown as wrong in codechef ?
I am trying to run my program written fir solving the problem “Fake Binary Search” as a part of “May challenge 2018 DivB” but I am getting a strange compilation error for my JAVA code. Firstly, the program takes almost 40 minutes to run and the ide says “Submission Queued”. After completion, I get the following compilation error:
## Not FoundThe resource could not be found.
Please help me someone. I am facing this strange issue first time. Is this a fault of mine or the codechef server has a problem?
I am trying to run my program written fir solving the problem “Fake Binary Search” as a part of “May challenge 2018 DivB” but I am getting a strange compilation error for my JAVA code. Firstly, the program takes almost 40 minutes to run and the ide says “Submission Queued”. After completion, I get the following compilation error:
## Not FoundThe resource could not be found.
Please help me someone. I am facing this strange issue first time. Is this a fault of mine or the codechef server has a problem?
Hello.
So the following the code which works absolutely fine in netbeans but when I upload on CODECHEF, it shows COMPILATION ERROR. Plz help.
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int l,b;
System.out.println("Enter length and breadth: ");
l=in.nextInt();
b=in.nextInt();
float area, peri;
area = l*b;
peri = 2*(l+b);
if(area>peri){
System.out.println("Area");
System.out.println("Area="+area);
}
else
System.out.println("Perimeter");
System.out.println("Perimeter"+peri);
}
}
Yes. Sometimes output of codeblocks and codechef do differ- but ultimately thats due to some fault in your code which codeblocks ignores but codechef doesnt.
It has been the same for everyone for more than 1 hour. There are some problems with codechef submission. Admin, please fix this issue asap.