Page 1 of 1

compile error

Posted: Fri Sep 20, 2002 2:06 am
by corey
not sure why... but I get a compile error when I try to submit my program....

Here are the compiler error messages:

01101644_24.c:5: `#include' expects "FILENAME" or

--

source:

/* @JUDGE_ID: XXXXXX 100 C++ "Looping" */


#include<iostream.h>

int main()
{
long n,x,p,i=0,bigi=0;
long first,last;
cin>>p>>x;
first=p; last=x;
while(p<=x) {
n=p;
while(1) {
if(n==1) {i++; /*cout<<i<<" ";*/ break;}
i++;
if(n%2!=0)
n=3*n+1;
else
n=n/2;
}
if(i>bigi) bigi=i;
p++;
i=0;
}
cout<<first<<" "<<last<<" "<<bigi;
cout<<endl;
return 0;
}

Posted: Fri Sep 20, 2002 8:07 am
by Dominik Michniewski
I'm not sure what's true, but possible reasons of that could be:

1. maybe try to add space between 'include' and '<ios....'
2. <iostream.h> is not part of ANSI C++ (I write my solutions in C only and I don't know that :-( )
3. <iostream.h> is part of ANSI C++, but isn't allowed by judge

Best regards
Dominik

Posted: Fri Sep 20, 2002 8:25 am
by Picard
it gets compiled to me (and wrong answer). you should compare the source with the "program received" email you got from the judge. maybe your mailer is messing up something in the source.

HTML

Posted: Fri Sep 20, 2002 8:49 am
by shahriar_manzoor
May be u r sending your email in html format. You should send it in plain text format

Posted: Fri Sep 20, 2002 6:19 pm
by corey
the above code is the source that the judge sent back to me...

i have no clue why it will not work.......

Posted: Fri Sep 20, 2002 9:11 pm
by arc16
this happened when using iostream, don't know why though...
change:

Code: Select all

#include <iostream.h>
into:

Code: Select all

#include <iostream>
and submit as C++
and like picard said.. you got wrong answer :P

Posted: Tue Sep 24, 2002 6:31 pm
by freaky
Dominik Michniewski wrote:I'm not sure what's true, but possible reasons of that could be:

1. maybe try to add space between 'include' and '<ios....'
2. <iostream.h> is not part of ANSI C++ (I write my solutions in C only and I don't know that :-( )
3. <iostream.h> is part of ANSI C++, but isn't allowed by judge

Best regards
Dominik
<iostream.h> is not part of ANSI C++, but is allowed by the judge.
All standard headers (not necessarily being files) have no suffix.

Posted: Wed Sep 25, 2002 7:43 am
by Dominik Michniewski
I know, that i.e. <vector>, <algorithm> are standard C++ header files, but I don't know what set of such files are allowed by judge !
I couldn't find any word on this site about list of allowed headers and functions - and if I want to avoid Compile Error I can't use it :-(

When I write programs in C I know, that any header from standard ANSI C is allowed - could you tell me when I could find such list for ANSI C++?
In C it's very limited list - no more than ten files ... :-)

Best regards
Dominik

Posted: Fri Sep 27, 2002 8:02 am
by freaky
Dominik Michniewski wrote:I know, that i.e. <vector>, <algorithm> are standard C++ header files, but I don't know what set of such files are allowed by judge !
I couldn't find any word on this site about list of allowed headers and functions - and if I want to avoid Compile Error I can't use it :-(

When I write programs in C I know, that any header from standard ANSI C is allowed - could you tell me when I could find such list for ANSI C++?
In C it's very limited list - no more than ten files ... :-)

Best regards
Dominik
Since the judge uses gcc (seems 2.95), just check the documentations. If you make heavy use of Standard C++ Library, then you'll be frustrated as I am because libstdc++ is not very conformant.

Posted: Sun Oct 06, 2002 9:51 pm
by cothevacothe
I use Java and hardly can submit due to compiled error.
Could anybody help me with this??
Here are the compiler error messages:

/tmp/cc4XPsPymain.o: In function `main':
/tmp/ccQ4tHyCmain.i(.text+0x12): undefined reference to `_CL_4Main'
collect2: ld returned 1 exit status

Posted: Mon Oct 07, 2002 5:38 am
by ithamar
Your problem its that your class name is not called Main. You shuld read the info about java suport.

Hope can help