what does compiler error mean?

W

wenmang

Hi all,

I got following error when compiling a rogram:
prelink: ERROR: operator <<<T1, T2, T3>(ostream &, const
basic_string<T1, T2, T3> &) [with T1=char, T2=char_traits<char>,
T3=allocator<char>, return type=ostream &] assigned to a.o and b.o
prelink: ERROR: bad instantiation request file -- instantiation
assigned to more than one file
UX:CC: ERROR: Pre-linker failed

In both places, I use cout as ostream, not sure why it happen. I build
with make clean, it disappeared. But I change one component, e.g., a.C,
then when linking, I got the error.
thx
 
F

Frederick Gotham

(e-mail address removed) posted:
Hi all,

I got following error when compiling a rogram:
prelink: ERROR: operator <<<T1, T2, T3>(ostream &, const
basic_string<T1, T2, T3> &) [with T1=char, T2=char_traits<char>,
T3=allocator<char>, return type=ostream &] assigned to a.o and b.o
prelink: ERROR: bad instantiation request file -- instantiation
assigned to more than one file
UX:CC: ERROR: Pre-linker failed

In both places, I use cout as ostream, not sure why it happen. I build
with make clean, it disappeared. But I change one component, e.g., a.C,
then when linking, I got the error.


Might I suggest you post a small sample of code which produces the same
error.
 
W

wenmang

I hope I can. But 2 components each has 1000 lines of code, it is hard.
Frederick said:
(e-mail address removed) posted:
Hi all,

I got following error when compiling a rogram:
prelink: ERROR: operator <<<T1, T2, T3>(ostream &, const
basic_string<T1, T2, T3> &) [with T1=char, T2=char_traits<char>,
T3=allocator<char>, return type=ostream &] assigned to a.o and b.o
prelink: ERROR: bad instantiation request file -- instantiation
assigned to more than one file
UX:CC: ERROR: Pre-linker failed

In both places, I use cout as ostream, not sure why it happen. I build
with make clean, it disappeared. But I change one component, e.g., a.C,
then when linking, I got the error.


Might I suggest you post a small sample of code which produces the same
error.
 
W

wenmang

I need suggestion where I should look for. Why "make clean" can sovle
the problem, while it will not work if not "make clean", do I have
build env issue? or something funny here?
 
B

BobR

(e-mail address removed) wrote in message
I need suggestion where I should look for. Why "make clean" can sovle
the problem, while it will not work if not "make clean", do I have
build env issue? or something funny here?

[OT]

Let's say you have three files in your project - A.h, A.cpp, Main.cpp:
[assume you are using an IDE that runs 'make' on a makefile.]

// A.h
int SomeFunc();

// A.cpp
int SomeFunc(){ return 50000 * 60000; }

// Main.cpp
#include A.h

int main(){
int Anumber = SomeFunc();
return 0;
}

Assume it compiles and runs.
Now you decide that SomeFunc() should return an long instead of an int, so
you change it:

// A.h
long SomeFunc();

// A.cpp
long SomeFunc(){ return 50000 * 60000; }

....and compile the project again. It compiles, but won't 'build'. What
happened?

The first time it took A.cpp and Main.cpp and produced A.o (or A.obj) and
Main.o and then 'linked' the two together to 'Main' (or 'Main.exe').
Then you changed A.cpp, and tried to build it. The 'make' re-built A.o, but
noticed that Main.cpp and Main.o had the SAME time/date, so, it did NOT
rebuild it! Then the 'linker' tried to match the 'int' call to SomeFunc()
[which now returns an long]. The linker pukes!!

Doing 'make clean' deletes ALL the *.o files so that ALL files are rebuilt
and linked.

MY explaination may not be correct or complete; but I hope it showed enough
for you to see why 'make clean' is needed (in this case, the compiler would
quit at the long to int problem, and never make it to the link stage.).

Does that clear up anything for you?
Since the subject is Off Topic in this NG, we can't discuss it much further,
you'll have to read your docs or ask in an NG specific to your
compiler/make/linker.

[/OT]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top