compile error

Post here if you don't find any other place for your post. But please, stay on-topic: algorithms, programming or something related to this web site and its services.

Moderator: Board moderators

Post Reply
corey
New poster
Posts: 2
Joined: Fri Sep 20, 2002 2:03 am

compile error

Post 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;
}
Dominik Michniewski
Guru
Posts: 834
Joined: Wed May 29, 2002 4:11 pm
Location: Wroclaw, Poland
Contact:

Post 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
Picard
Learning poster
Posts: 96
Joined: Mon Jun 24, 2002 1:22 pm
Location: Hungary
Contact:

Post 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.
shahriar_manzoor
System administrator & Problemsetter
Posts: 399
Joined: Sat Jan 12, 2002 2:00 am

HTML

Post by shahriar_manzoor »

May be u r sending your email in html format. You should send it in plain text format
corey
New poster
Posts: 2
Joined: Fri Sep 20, 2002 2:03 am

Post by corey »

the above code is the source that the judge sent back to me...

i have no clue why it will not work.......
arc16
Learning poster
Posts: 62
Joined: Sun Aug 04, 2002 1:05 am
Location: Indonesia

Post 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
freaky
New poster
Posts: 6
Joined: Sat Sep 14, 2002 11:27 pm
Location: Taipei

Post 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.
Dominik Michniewski
Guru
Posts: 834
Joined: Wed May 29, 2002 4:11 pm
Location: Wroclaw, Poland
Contact:

Post 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
freaky
New poster
Posts: 6
Joined: Sat Sep 14, 2002 11:27 pm
Location: Taipei

Post 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.
cothevacothe
New poster
Posts: 3
Joined: Sun Oct 06, 2002 9:49 pm

Post 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
A gentle man is a patient wolf.
ithamar
Learning poster
Posts: 56
Joined: Mon May 13, 2002 11:58 pm
Location: Venezuela

Post by ithamar »

Your problem its that your class name is not called Main. You shuld read the info about java suport.

Hope can help
Those Who Don't Know History are doomed to repeat it
Post Reply

Return to “Other words”