Volumes Of Fun
http://www.volumesoffun.com/phpBB3/

PolyVox Multiple Defined Symbols Problem
http://www.volumesoffun.com/phpBB3/viewtopic.php?f=14&t=175
Page 1 of 1

Author:  GM_Riscvul [ Thu Mar 17, 2011 6:10 am ]
Post subject:  PolyVox Multiple Defined Symbols Problem

I am having problems with linker errors when compiling my polyvox project.
The linker complains of multiple defined symbols no matter how isolated I
make the polyvox includes.
For some reason even when I put them into my precompiled header file
they are apparently being included more than once.

I get five errors that all look about like this.

Error 52 error LNK2005: "private: void __thiscall PolyVox::MeshDecimator<class PolyVox::PositionMaterial>::fillInitialVertexMetadata(class std::vector<struct PolyVox::MeshDecimator<class PolyVox::PositionMaterial>::InitialVertexMetadata,class std::allocator<struct PolyVox::MeshDecimator<class PolyVox::PositionMaterial>::InitialVertexMetadata> > &)" (?fillInitialVertexMetadata@?$MeshDecimator@VPositionMaterial@PolyVox@@@...
...PolyVox@@AAEXAAV?$vector@UInitialVertexMetadata@?$MeshDecimator@...
...VPositionMaterial@PolyVox@@@PolyVox@@V?$allocator@UInitialVertexMetadata@...
...?$MeshDecimator@VPositionMaterial@PolyVox@@@PolyVox@@@std@@@std@@@Z) already defined in WorldCraft.obj C:\Users\Devin Nelson\Documents\Visual Studio 2010\Projects\WorldCraft\WorldCraft\WorldManager.obj WorldCraft

They are all related to the MeshDecimator class.
I can't figure out what I am doing wrong.
It must be related to some error in my includes, but I can't find any duplicate includes anywhere.

Here are the only polyvox includes being used that I am aware of.
// Polyvox includes
#include "Filters.h"
#include "Log.h"
#include "MaterialDensityPair.h"
#include "Volume.h"
#include "SurfaceMesh.h"
#include "MeshDecimator.h"
#include "PolyVoxImpl/Utility.h"
#include "VertexTypes.h"
#include "SurfaceExtractor.h"

I appreciate the help I have been given so far. Thanks

Author:  David Williams [ Thu Mar 17, 2011 12:54 pm ]
Post subject:  Re: PolyVox Multiple Defined Symbols Problem

Ok, I can't say for sure as I will need more time to do some testing, but there is a chance this is a problem in PolyVox. In particular, the function you list (fillInitialVertexMetadata()) has two complete implementations, one for PositionMaterial and one for PositionMaterialNormal. Because these implementations do not take any template parameters it may be incorrect for them to be in the .inl file. They may need to be in a .cpp file instead.

I'm not certain how these need to be arranged, I will try to look at it tonight but probably won't manage until tomorrow.

Author:  DefiniteIntegral [ Fri Mar 18, 2011 3:17 am ]
Post subject:  Re: PolyVox Multiple Defined Symbols Problem

I have noticed the same problem. For me it was with MeshDecimator.h

I found that the only way to compile my project was to include it in a single .cpp file only. If I included MeshDecimator.h anywhere else in my project, especially in any .h file, I would get the 'already defined' compiler error.

Author:  GM_Riscvul [ Fri Mar 18, 2011 5:48 pm ]
Post subject:  Re: PolyVox Multiple Defined Symbols Problem

Yes that is the same for me. MeshDecimator.h is the problem.
I can work around for now by including it in one cpp file only, but it would be nice to include it in my header file.

I wonder if there is any easy edits I could make to the library to fix this?

Author:  David Williams [ Fri Mar 18, 2011 10:06 pm ]
Post subject:  Re: PolyVox Multiple Defined Symbols Problem

Ok, I think I've fixed this in the trunk, so let me know if it works. If you are on the RLE branch you'll have to wait until it gets merged in to the trunk. Or if you are feeling brave you can bring the patch across yourself (it's revision 1421).

Author:  GM_Riscvul [ Tue Mar 22, 2011 5:20 pm ]
Post subject:  Re: PolyVox Multiple Defined Symbols Problem

Sorry for the delay, school has been busy lately.

Yes the changes worked. I can now include MeshDecimator.h in my precompiled header file.

Thank you for the fix and help!

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/