please clarify me why it gives me "Compile Error"

Write here if you have problems with your C++ source code

Moderator: Board moderators

Post Reply
wook
Learning poster
Posts: 76
Joined: Fri Oct 01, 2004 11:34 am
Location: Korea, Republic Of

please clarify me why it gives me "Compile Error"

Post by wook »

I can't know why it gives me CE.

please, help me. :)

Code: Select all

//uva 10986 sending e-mails

#if 1
typedef long long xint;
#define format "%lld\n"
#else 
typedef __int64 xint;
#define format "%I64d\n"
#endif

#include <stdio.h>
#include <queue>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

vector< pair<int, int> > gr[20001];
xint c[20001]; bool d[20001];

cutted----

}
Last edited by wook on Fri May 19, 2006 2:23 pm, edited 1 time in total.
Sorry For My Poor English.. :)

Dzhefri
New poster
Posts: 8
Joined: Mon May 15, 2006 8:46 am

Post by Dzhefri »

Did you get an email explaining the compiler errors?

Krzysztof Duleba
Guru
Posts: 584
Joined: Thu Jun 19, 2003 3:48 am
Location: Sanok, Poland
Contact:

Post by Krzysztof Duleba »

In gcc 2.95 file iostream.h contains this definitions:

Code: Select all

    ostream& form(const char *format ...);
    ostream& vform(const char *format, _IO_va_list args);

    istream& scan(const char *format ...);
    istream& vscan(const char *format, _IO_va_list args);
You defined format to be "%lld\n", so they don't make any sense anymore.

Move your defines after all the includes and you will be fine. This is a general rule: don't define anything before includes unless you want to change how libraries behave.

wook
Learning poster
Posts: 76
Joined: Fri Oct 01, 2004 11:34 am
Location: Korea, Republic Of

Post by wook »

Krzysztof Duleba, Thanks very much.
I will keep in mind that a trivial but very important rule!
Sorry For My Poor English.. :)

Post Reply

Return to “C++”