Why do i get a compile error?

ce
compileerror
exception
faq

#1

My code compiles on my machine, however, it gets compilation error on CodeChef why so?


#2

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.


#3

if turbo compiler is not such compiler than which compiler should i use?


#4

watch on you tube how to submit a program on codechef,then you will find out solution of your problem.


#5

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


#6

instead of conio.h which library should i use???


#7

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.


#8

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.


#9

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?


#10

@depanshushani , don’t use it at all. Use only <stdio.h>. Codechef doesn’t use Turbo C compiler. :slight_smile:


#11

@kunnu27
I use CodeBlocks. It is Best. You can download it and code here.

And I suggest you to code on codechef online IDE.


#12

My code works fine on codeblocks and codechef IDE still I get compile time error. Can someone help me out.


#13

My code works fine on codeblocks and codechef IDE still I get compile time error. Can someone help me out.


#14

If code blocks is such a compiler ?


#15

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 ?


#16

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 Found

The 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?


#17

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 Found

The 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?


#18

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);

}
}


#19

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.


#20

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.