Page 1 of 1

please clarify me why it gives me "Compile Error"

Posted: Fri May 19, 2006 12:05 pm
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----

}

Posted: Fri May 19, 2006 12:47 pm
by Dzhefri
Did you get an email explaining the compiler errors?

Posted: Fri May 19, 2006 12:50 pm
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.

Posted: Fri May 19, 2006 2:22 pm
by wook
Krzysztof Duleba, Thanks very much.
I will keep in mind that a trivial but very important rule!