By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,159 Members | 980 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,159 IT Pros & Developers. It's quick & easy.

what does compiler error mean?

P: n/a
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

Oct 3 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
we*****@yahoo.com 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.

--

Frederick Gotham
Oct 3 '06 #2

P: n/a
I hope I can. But 2 components each has 1000 lines of code, it is hard.
Frederick Gotham wrote:
we*****@yahoo.com 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.

--

Frederick Gotham
Oct 3 '06 #3

P: n/a
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?

Oct 3 '06 #4

P: n/a

we*****@yahoo.com wrote in message
<11**********************@h48g2000cwc.googlegroups .com>...
>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]

--
Bob R
POVrookie
Oct 4 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.