I'm wondering why I get this message when I try to use a stl queue in a managed class. I'm using .net 1.1, so i can't use the new 2.0 typed queue.
error:
error LNK4006: "class std::queue<short,class std::deque<short,class std::allocator<short> > > * (* ALDaps::que)[64]" ( que@ALDaps@@3PAY0EA@PAV $queue@FV $deque@FV $allocator@F@std@@@std@@@std@@A) already defined in main.obj; second definition ignored
So, I added FORCE:MULTIPLE to the linker options, and it turns it into a warning. Is this going to have any negative effects on my program

stl queue - why don't you work
needsalagoon
I just ran a very simple console app, with a __gc class and it worked fine.
So, I'm guessing that you are right Jonathan...
The queue actually works just fine...it seems...however, I'm just worried about any nasty effects.
Here is my output from the compiler...
Linking...
events7.obj : warning LNK4006: "class std::queue<short,class std::deque<short,class std::allocator<short> > > * (* ALDaps::que)[64]" ( que@ALDaps@@3PAY0EA@PAV $queue@FV $deque@FV $allocator@F@std@@@std@@@std@@A) already defined in main.obj; second definition ignored
Recording.obj : warning LNK4006: "class std::queue<short,class std::deque<short,class std::allocator<short> > > * (* ALDaps::que)[64]" ( que@ALDaps@@3PAY0EA@PAV $queue@FV $deque@FV $allocator@F@std@@@std@@@std@@A) already defined in main.obj; second definition ignored
scancallback2.obj : warning LNK4006: "class std::queue<short,class std::deque<short,class std::allocator<short> > > * (* ALDaps::que)[64]" ( que@ALDaps@@3PAY0EA@PAV $queue@FV $deque@FV $allocator@F@std@@@std@@@std@@A) already defined in main.obj; second definition ignored
support5.obj : warning LNK4006: "class std::queue<short,class std::deque<short,class std::allocator<short> > > * (* ALDaps::que)[64]" ( que@ALDaps@@3PAY0EA@PAV $queue@FV $deque@FV $allocator@F@std@@@std@@@std@@A) already defined in main.obj; second definition ignored
updateglobal2.obj : warning LNK4006: "class std::queue<short,class std::deque<short,class std::allocator<short> > > * (* ALDaps::que)[64]" ( que@ALDaps@@3PAY0EA@PAV $queue@FV $deque@FV $allocator@F@std@@@std@@@std@@A) already defined in main.obj; second definition ignored
C:\projects\ALDaps\Debug\ALDaps.exe : warning LNK4088: image being generated due to /FORCE option; image may not run
Maysam
namespace
ALDaps{
queue<
short>*que[4][64]; public __gc class Recording : public Form{
public:Recording(
void);...
..};
}
Scott Mauvais
I also should point out that this is the ISO/IEC class template queue - it has nothing to do with the CLR containers System::Collections::Queue and System::Collections::Generic::Queue.
This also look like a simple case of a multiple definition - you should preprocess both files and see if the definition appears in each of them - it is does then you should mark one of them as 'extern'.
philipbennett25
Tony Bierman
Could you post a *minimal* reproduction here so we can try it out
Thanks,
Brian
PaulG
This almost certainly will cause you problem in the long-term you should definitely attempt to trackdown why this is happening.
If I had to guess I would say that ALDaps::que is defined in a header file. You should turn this definition into a declaration (mark it as 'extern' and remove any initializer) and then you should add a definition to one of the *.cpp files.