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

[Resolved]Linking errors
http://www.volumesoffun.com/phpBB3/viewtopic.php?f=15&t=314
Page 1 of 1

Author:  drwbns [ Fri Jan 13, 2012 7:02 pm ]
Post subject:  [Resolved]Linking errors

Hello, I was getting linking errors in a project that uses PolyVox and I was hoping someone could explain why. This isn't neccessarily a PolyVox bug, but could be just the wrong way of calling the functions, but I'm not sure so I'm posting here. I get a list of unresolved symbols that look like so -

Code:
1>MeshManager.obj : error LNK2019: unresolved external symbol "public: __thiscall PolyVox::Region::Region(class PolyVox::Vector<3,int> const &,class PolyVox::Vector<3,int> const &)" (??0Region@PolyVox@@QAE@ABV?$Vector@$02H@1@0@Z) referenced in function "public: void __thiscall MeshManager::operator()(void)" (??RMeshManager@@QAEXXZ)
1>WorldManager.obj : error LNK2001: unresolved external symbol "public: __thiscall PolyVox::Region::Region(class PolyVox::Vector<3,int> const &,class PolyVox::Vector<3,int> const &)" (??0Region@PolyVox@@QAE@ABV?$Vector@$02H@1@0@Z)
1>MeshManager.obj : error LNK2019: unresolved external symbol "public: class PolyVox::Vector<3,int> const & __thiscall PolyVox::Region::getLowerCorner(void)const " (?getLowerCorner@Region@PolyVox@@QBEABV?$Vector@$02H@2@XZ) referenced in function "public: virtual bool __thiscall MeshManager::frameRenderingQueued(struct Ogre::FrameEvent const &)" (?frameRenderingQueued@MeshManager@@UAE_NABUFrameEvent@Ogre@@@Z)
1>WorldManager.obj : error LNK2001: unresolved external symbol "public: class PolyVox::Vector<3,int> const & __thiscall PolyVox::Region::getLowerCorner(void)const " (?getLowerCorner@Region@PolyVox@@QBEABV?$Vector@$02H@2@XZ)
1>MeshManager.obj : error LNK2019: unresolved external symbol "public: void __thiscall PolyVox::Region::setUpperCorner(class PolyVox::Vector<3,int> const &)" (?setUpperCorner@Region@PolyVox@@QAEXABV?$Vector@$02H@2@@Z) referenced in function "public: __thiscall PolyVox::SurfaceExtractor<class PolyVox::LargeVolume,class PolyVox::MaterialDensityPair<unsigned char,4,4> >::SurfaceExtractor<class PolyVox::LargeVolume,class PolyVox::MaterialDensityPair<unsigned char,4,4> >(class PolyVox::LargeVolume<class PolyVox::MaterialDensityPair<unsigned char,4,4> > *,class PolyVox::Region,class PolyVox::SurfaceMesh<class PolyVox::PositionMaterialNormal> *)" (??0?$SurfaceExtractor@VLargeVolume@PolyVox@@V?$MaterialDensityPair@E$03$03@2@@PolyVox@@QAE@PAV?$LargeVolume@V?$MaterialDensityPair@E$03$03@PolyVox@@@1@VRegion@1@PAV?$SurfaceMesh@VPositionMaterialNormal@PolyVox@@@1@@Z)
1>WorldManager.obj : error LNK2001: unresolved external symbol "public: void __thiscall PolyVox::Region::setUpperCorner(class PolyVox::Vector<3,int> const &)" (?setUpperCorner@Region@PolyVox@@QAEXABV?$Vector@$02H@2@@Z)
1>MeshManager.obj : error LNK2019: unresolved external symbol "public: class PolyVox::Vector<3,int> const & __thiscall PolyVox::Region::getUpperCorner(void)const " (?getUpperCorner@Region@PolyVox@@QBEABV?$Vector@$02H@2@XZ) referenced in function "public: __thiscall PolyVox::SurfaceExtractor<class PolyVox::LargeVolume,class PolyVox::MaterialDensityPair<unsigned char,4,4> >::SurfaceExtractor<class PolyVox::LargeVolume,class PolyVox::MaterialDensityPair<unsigned char,4,4> >(class PolyVox::LargeVolume<class PolyVox::MaterialDensityPair<unsigned char,4,4> > *,class PolyVox::Region,class PolyVox::SurfaceMesh<class PolyVox::PositionMaterialNormal> *)" (??0?$SurfaceExtractor@VLargeVolume@PolyVox@@V?$MaterialDensityPair@E$03$03@2@@PolyVox@@QAE@PAV?$LargeVolume@V?$MaterialDensityPair@E$03$03@PolyVox@@@1@VRegion@1@PAV?$SurfaceMesh@VPositionMaterialNormal@PolyVox@@@1@@Z)
1>WorldManager.obj : error LNK2001: unresolved external symbol "public: class PolyVox::Vector<3,int> const & __thiscall PolyVox::Region::getUpperCorner(void)const " (?getUpperCorner@Region@PolyVox@@QBEABV?$Vector@$02H@2@XZ)
1>MeshManager.obj : error LNK2019: unresolved external symbol "public: void __thiscall PolyVox::Region::shift(class PolyVox::Vector<3,int> const &)" (?shift@Region@PolyVox@@QAEXABV?$Vector@$02H@2@@Z) referenced in function "public: void __thiscall PolyVox::SurfaceExtractor<class PolyVox::LargeVolume,class PolyVox::MaterialDensityPair<unsigned char,4,4> >::execute(void)" (?execute@?$SurfaceExtractor@VLargeVolume@PolyVox@@V?$MaterialDensityPair@E$03$03@2@@PolyVox@@QAEXXZ)
1>MeshManager.obj : error LNK2019: unresolved external symbol "public: bool __thiscall PolyVox::Region::containsPoint(class PolyVox::Vector<3,int> const &,unsigned char)const " (?containsPoint@Region@PolyVox@@QBE_NABV?$Vector@$02H@2@E@Z) referenced in function "public: void __thiscall PolyVox::LargeVolume<class PolyVox::MaterialDensityPair<unsigned char,4,4> >::Sampler::setPosition(int,int,int)" (?setPosition@Sampler@?$LargeVolume@V?$MaterialDensityPair@E$03$03@PolyVox@@@PolyVox@@QAEXHHH@Z)
1>WorldManager.obj : error LNK2001: unresolved external symbol "public: bool __thiscall PolyVox::Region::containsPoint(class PolyVox::Vector<3,int> const &,unsigned char)const " (?containsPoint@Region@PolyVox@@QBE_NABV?$Vector@$02H@2@E@Z)
1>MeshManager.obj : error LNK2019: unresolved external symbol "private: bool __thiscall PolyVox::MeshDecimator<class PolyVox::PositionMaterialNormal>::canCollapseNormalEdge(unsigned int,unsigned int)" (?canCollapseNormalEdge@?$MeshDecimator@VPositionMaterialNormal@PolyVox@@@PolyVox@@AAE_NII@Z) referenced in function "private: bool __thiscall PolyVox::MeshDecimator<class PolyVox::PositionMaterialNormal>::canCollapseEdge(unsigned int,unsigned int)" (?canCollapseEdge@?$MeshDecimator@VPositionMaterialNormal@PolyVox@@@PolyVox@@AAE_NII@Z)
1>MeshManager.obj : error LNK2019: unresolved external symbol "unsigned char __cdecl PolyVox::logBase2(unsigned int)" (?logBase2@PolyVox@@YAEI@Z) referenced in function "public: void __thiscall PolyVox::Block<class PolyVox::MaterialDensityPair<unsigned char,4,4> >::initialise(unsigned short)" (?initialise@?$Block@V?$MaterialDensityPair@E$03$03@PolyVox@@@PolyVox@@QAEXG@Z)
1>WorldManager.obj : error LNK2001: unresolved external symbol "unsigned char __cdecl PolyVox::logBase2(unsigned int)" (?logBase2@PolyVox@@YAEI@Z)
1>MeshManager.obj : error LNK2019: unresolved external symbol "bool __cdecl PolyVox::isPowerOf2(unsigned int)" (?isPowerOf2@PolyVox@@YA_NI@Z) referenced in function "public: void __thiscall PolyVox::Block<class PolyVox::MaterialDensityPair<unsigned char,4,4> >::initialise(unsigned short)" (?initialise@?$Block@V?$MaterialDensityPair@E$03$03@PolyVox@@@PolyVox@@QAEXG@Z)
1>WorldManager.obj : error LNK2001: unresolved external symbol "bool __cdecl PolyVox::isPowerOf2(unsigned int)" (?isPowerOf2@PolyVox@@YA_NI@Z)
1>WorldManager.obj : error LNK2019: unresolved external symbol "public: void __thiscall PolyVox::Region::setLowerCorner(class PolyVox::Vector<3,int> const &)" (?setLowerCorner@Region@PolyVox@@QAEXABV?$Vector@$02H@2@@Z) referenced in function "public: void __thiscall PolyVox::LargeVolume<class PolyVox::MaterialDensityPair<unsigned char,4,4> >::resize(class PolyVox::Region const &,unsigned short)" (?resize@?$LargeVolume@V?$MaterialDensityPair@E$03$03@PolyVox@@@PolyVox@@QAEXABVRegion@2@G@Z)
1>PolyVoxCore.lib(MeshDecimator.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::_Container_base_secure::_Orphan_all(void)const " (__imp_?_Orphan_all@_Container_base_secure@std@@QBEXXZ) referenced in function __catch$?reserve@?$vector@UIntVertex@?$MeshDecimator@VPositionMaterial@PolyVox@@@PolyVox@@V?$allocator@UIntVertex@?$MeshDecimator@VPositionMaterial@PolyVox@@@PolyVox@@@std@@@std@@QAEXI@Z$0
1>PolyVoxCore.lib(MeshDecimator.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall std::_Container_base_secure::~_Container_base_secure(void)" (__imp_??1_Container_base_secure@std@@QAE@XZ) referenced in function "protected: __thiscall std::_Container_base_aux_alloc_empty<class std::allocator<struct PolyVox::MeshDecimator<class PolyVox::PositionMaterial>::IntVertex> >::~_Container_base_aux_alloc_empty<class std::allocator<struct PolyVox::MeshDecimator<class PolyVox::PositionMaterial>::IntVertex> >(void)" (??1?$_Container_base_aux_alloc_empty@V?$allocator@UIntVertex@?$MeshDecimator@VPositionMaterial@PolyVox@@@PolyVox@@@std@@@std@@IAE@XZ)
1>PolyVoxCore.lib(MeshDecimator.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall std::_Container_base_secure::_Container_base_secure(void)" (__imp_??0_Container_base_secure@std@@QAE@XZ) referenced in function "protected: __thiscall std::_Container_base_aux_alloc_empty<class std::allocator<struct PolyVox::MeshDecimator<class PolyVox::PositionMaterial>::IntVertex> >::_Container_base_aux_alloc_empty<class std::allocator<struct PolyVox::MeshDecimator<class PolyVox::PositionMaterial>::IntVertex> >(class std::allocator<struct PolyVox::MeshDecimator<class PolyVox::PositionMaterial>::IntVertex>)" (??0?$_Container_base_aux_alloc_empty@V?$allocator@UIntVertex@?$MeshDecimator@VPositionMaterial@PolyVox@@@PolyVox@@@std@@@std@@IAE@V?$allocator@UIntVertex@?$MeshDecimator@VPositionMaterial@PolyVox@@@PolyVox@@@1@@Z)


I'm linking to the core and util library files and I think the use is correct, but I wanted to make sure here. Here is the the first line -

Code:
         PolyVox::Region reg(*(new Vector3DInt32(x,y,z)), *(new Vector3DInt32(x + 32,y + 32,z + 32)));


Any help or suggestions would be great, thanks

Author:  drwbns [ Fri Jan 13, 2012 7:33 pm ]
Post subject:  Re: Linking errors

I solved it by building PolyVox with vs2010 - which is what I was building my project with.

Author:  David Williams [ Fri Jan 13, 2012 10:04 pm ]
Post subject:  Re: [Resolved]Linking errors

Yes, I think it can make a difference which version of Visual Studio you use. I'm not sure of the exact rules but play it safe and use the same version for everything where possible.

Also:
drwbns wrote:
Code:
PolyVox::Region reg(*(new Vector3DInt32(x,y,z)), *(new Vector3DInt32(x + 32,y + 32,z + 32)));

There is no need to use 'new' here. Doing so has performance implications (allocating memory on the heap) and you also have no way to delete it as you don't keep a pointer to it. You should just use:

Code:
PolyVox::Region reg(Vector3DInt32(x,y,z), Vector3DInt32(x + 32,y + 32,z + 32));

Author:  Sray [ Sun Feb 05, 2012 2:08 am ]
Post subject:  Re: [Resolved]Linking errors

Hello,

I'm new to polyvox, and i'm trying to display the basic sphere. But i've got linking error when trying to compile.

I use VS2010 for both and i get this errors :

Code:
Error   14   error LNK1120: 13 unresolved externals   F:\OgreExperiment\proto\OgreApp3\OgreApp3\bin\Debug\\OgreApp3.exe   OgreApp3
Error   13   error LNK2019: unresolved external symbol "bool __cdecl PolyVox::isPowerOf2(unsigned int)" (?isPowerOf2@PolyVox@@YA_NI@Z) referenced in function "public: void __thiscall PolyVox::SimpleVolume<class PolyVox::MaterialDensityPair<unsigned char,4,4> >::resize(class PolyVox::Region const &,unsigned short)" (?resize@?$SimpleVolume@V?$MaterialDensityPair@E$03$03@PolyVox@@@PolyVox@@QAEXABVRegion@2@G@Z)   F:\OgreExperiment\proto\OgreApp3\OgreApp3\OgreApp3.obj   OgreApp3
Error   3   error LNK2019: unresolved external symbol "private: void __thiscall OgreApp3::createSphereInVolume(class PolyVox::SimpleVolume<class PolyVox::MaterialDensityPair<unsigned char,4,4> > &,float)" (?createSphereInVolume@OgreApp3@@AAEXAAV?$SimpleVolume@V?$MaterialDensityPair@E$03$03@PolyVox@@@PolyVox@@M@Z) referenced in function "protected: virtual void __thiscall OgreApp3::createScene(void)" (?createScene@OgreApp3@@MAEXXZ)   F:\OgreExperiment\proto\OgreApp3\OgreApp3\OgreApp3.obj   OgreApp3
Error   9   error LNK2019: unresolved external symbol "public: __thiscall PolyVox::PositionMaterialNormal::PositionMaterialNormal(class PolyVox::Vector<3,float>,class PolyVox::Vector<3,float>,float)" (??0PositionMaterialNormal@PolyVox@@QAE@V?$Vector@$02M@1@0M@Z) referenced in function "public: void __thiscall PolyVox::CubicSurfaceExtractorWithNormals<class PolyVox::SimpleVolume,class PolyVox::MaterialDensityPair<unsigned char,4,4> >::execute(void)" (?execute@?$CubicSurfaceExtractorWithNormals@VSimpleVolume@PolyVox@@V?$MaterialDensityPair@E$03$03@2@@PolyVox@@QAEXXZ)   F:\OgreExperiment\proto\OgreApp3\OgreApp3\OgreApp3.obj   OgreApp3
Error   4   error LNK2019: unresolved external symbol "public: __thiscall PolyVox::Region::Region(class PolyVox::Vector<3,int> const &,class PolyVox::Vector<3,int> const &)" (??0Region@PolyVox@@QAE@ABV?$Vector@$02H@1@0@Z) referenced in function "protected: virtual void __thiscall OgreApp3::createScene(void)" (?createScene@OgreApp3@@MAEXXZ)   F:\OgreExperiment\proto\OgreApp3\OgreApp3\OgreApp3.obj   OgreApp3
Error   7   error LNK2019: unresolved external symbol "public: __thiscall PolyVox::Region::Region(void)" (??0Region@PolyVox@@QAE@XZ) referenced in function "public: __thiscall PolyVox::SimpleVolume<class PolyVox::MaterialDensityPair<unsigned char,4,4> >::SimpleVolume<class PolyVox::MaterialDensityPair<unsigned char,4,4> >(class PolyVox::Region const &,unsigned short)" (??0?$SimpleVolume@V?$MaterialDensityPair@E$03$03@PolyVox@@@PolyVox@@QAE@ABVRegion@1@G@Z)   F:\OgreExperiment\proto\OgreApp3\OgreApp3\OgreApp3.obj   OgreApp3
Error   8   error LNK2019: unresolved external symbol "public: bool __thiscall PolyVox::Region::containsPoint(class PolyVox::Vector<3,int> const &,unsigned char)const " (?containsPoint@Region@PolyVox@@QBE_NABV?$Vector@$02H@2@E@Z) referenced in function "public: class PolyVox::MaterialDensityPair<unsigned char,4,4> __thiscall PolyVox::SimpleVolume<class PolyVox::MaterialDensityPair<unsigned char,4,4> >::getVoxelAt(int,int,int)const " (?getVoxelAt@?$SimpleVolume@V?$MaterialDensityPair@E$03$03@PolyVox@@@PolyVox@@QBE?AV?$MaterialDensityPair@E$03$03@2@HHH@Z)   F:\OgreExperiment\proto\OgreApp3\OgreApp3\OgreApp3.obj   OgreApp3
Error   1   error LNK2019: unresolved external symbol "public: class PolyVox::Vector<3,float> const & __thiscall PolyVox::PositionMaterialNormal::getNormal(void)const " (?getNormal@PositionMaterialNormal@PolyVox@@QBEABV?$Vector@$02M@2@XZ) referenced in function "protected: virtual void __thiscall OgreApp3::createScene(void)" (?createScene@OgreApp3@@MAEXXZ)   F:\OgreExperiment\proto\OgreApp3\OgreApp3\OgreApp3.obj   OgreApp3
Error   2   error LNK2019: unresolved external symbol "public: class PolyVox::Vector<3,float> const & __thiscall PolyVox::PositionMaterialNormal::getPosition(void)const " (?getPosition@PositionMaterialNormal@PolyVox@@QBEABV?$Vector@$02M@2@XZ) referenced in function "protected: virtual void __thiscall OgreApp3::createScene(void)" (?createScene@OgreApp3@@MAEXXZ)   F:\OgreExperiment\proto\OgreApp3\OgreApp3\OgreApp3.obj   OgreApp3
Error   5   error LNK2019: unresolved external symbol "public: class PolyVox::Vector<3,int> const & __thiscall PolyVox::Region::getLowerCorner(void)const " (?getLowerCorner@Region@PolyVox@@QBEABV?$Vector@$02H@2@XZ) referenced in function "public: int __thiscall PolyVox::BaseVolume<class PolyVox::MaterialDensityPair<unsigned char,4,4> >::getWidth(void)const " (?getWidth@?$BaseVolume@V?$MaterialDensityPair@E$03$03@PolyVox@@@PolyVox@@QBEHXZ)   F:\OgreExperiment\proto\OgreApp3\OgreApp3\OgreApp3.obj   OgreApp3
Error   6   error LNK2019: unresolved external symbol "public: class PolyVox::Vector<3,int> const & __thiscall PolyVox::Region::getUpperCorner(void)const " (?getUpperCorner@Region@PolyVox@@QBEABV?$Vector@$02H@2@XZ) referenced in function "public: int __thiscall PolyVox::BaseVolume<class PolyVox::MaterialDensityPair<unsigned char,4,4> >::getWidth(void)const " (?getWidth@?$BaseVolume@V?$MaterialDensityPair@E$03$03@PolyVox@@@PolyVox@@QBEHXZ)   F:\OgreExperiment\proto\OgreApp3\OgreApp3\OgreApp3.obj   OgreApp3
Error   12   error LNK2019: unresolved external symbol "public: void __thiscall PolyVox::Region::setLowerCorner(class PolyVox::Vector<3,int> const &)" (?setLowerCorner@Region@PolyVox@@QAEXABV?$Vector@$02H@2@@Z) referenced in function "public: void __thiscall PolyVox::SimpleVolume<class PolyVox::MaterialDensityPair<unsigned char,4,4> >::resize(class PolyVox::Region const &,unsigned short)" (?resize@?$SimpleVolume@V?$MaterialDensityPair@E$03$03@PolyVox@@@PolyVox@@QAEXABVRegion@2@G@Z)   F:\OgreExperiment\proto\OgreApp3\OgreApp3\OgreApp3.obj   OgreApp3
Error   11   error LNK2019: unresolved external symbol "public: void __thiscall PolyVox::Region::setUpperCorner(class PolyVox::Vector<3,int> const &)" (?setUpperCorner@Region@PolyVox@@QAEXABV?$Vector@$02H@2@@Z) referenced in function "public: void __thiscall PolyVox::SimpleVolume<class PolyVox::MaterialDensityPair<unsigned char,4,4> >::resize(class PolyVox::Region const &,unsigned short)" (?resize@?$SimpleVolume@V?$MaterialDensityPair@E$03$03@PolyVox@@@PolyVox@@QAEXABVRegion@2@G@Z)   F:\OgreExperiment\proto\OgreApp3\OgreApp3\OgreApp3.obj   OgreApp3
Error   10   error LNK2019: unresolved external symbol "unsigned char __cdecl PolyVox::logBase2(unsigned int)" (?logBase2@PolyVox@@YAEI@Z) referenced in function "public: void __thiscall PolyVox::SimpleVolume<class PolyVox::MaterialDensityPair<unsigned char,4,4> >::resize(class PolyVox::Region const &,unsigned short)" (?resize@?$SimpleVolume@V?$MaterialDensityPair@E$03$03@PolyVox@@@PolyVox@@QAEXABVRegion@2@G@Z)   F:\OgreExperiment\proto\OgreApp3\OgreApp3\OgreApp3.obj   OgreApp3


i use the basic application code from ogre3D and here is my createscene function :
Code:
PolyVox::SimpleVolume<PolyVox::MaterialDensityPair44> volData(PolyVox::Region(PolyVox::Vector3DInt32(0,0,0), PolyVox::Vector3DInt32(63, 63, 63)));
   createSphereInVolume(volData, 30);

   PolyVox::SurfaceMesh<PolyVox::PositionMaterialNormal> mesh;
   PolyVox::CubicSurfaceExtractorWithNormals<PolyVox::SimpleVolume, PolyVox::MaterialDensityPair44 > surfaceExtractor(&volData, volData.getEnclosingRegion(), &mesh);
   surfaceExtractor.execute();

   Ogre::ManualObject* ogremesh;

   ogremesh = mSceneMgr->createManualObject("Polyvox Mesh");
   ogremesh->setDynamic(true);
   ogremesh->begin("BaseWhiteNoLighting", Ogre::RenderOperation::OT_TRIANGLE_LIST);

   ogremesh->end();
   Ogre::SceneNode* ogreNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("testnode1", Ogre::Vector3(20, 0, 0));
   ogreNode->attachObject(ogremesh);

   ogremesh->beginUpdate(0);
   {
         const std::vector<uint32_t>& vecIndices = mesh.getIndices();
         const std::vector<PolyVox::PositionMaterialNormal>& vecVertices = mesh.getVertices();
         for (std::vector<PolyVox::PositionMaterialNormal>::const_iterator itVertex = vecVertices.begin(); itVertex != vecVertices.end(); ++itVertex)
         {
            const PolyVox::PositionMaterialNormal& vertex = *itVertex;
            const PolyVox::Vector3DFloat& vertPos = vertex.getPosition();         

            ogremesh->position(vertPos.getX(), vertPos.getY(), vertPos.getZ());
            ogremesh->normal(vertex.getNormal().getX(), vertex.getNormal().getY(), vertex.getNormal().getZ());
         }
         for (std::vector<uint32_t>::const_iterator itIdx = vecIndices.begin(); itIdx != vecIndices.end(); ++itIdx)
         {
            ogremesh->index(*itIdx);
         }
      }
      ogremesh->end();



Did you have any suggestions ?
thanks.

Author:  David Williams [ Mon Feb 06, 2012 9:19 am ]
Post subject:  Re: [Resolved]Linking errors

I don't know what is wrong here... are you sure you have told your project which libraries to link against? So it's linking against PolyVoxCore.lib and PolyVoxUtil.lib? Maybe you need to set the library path so it can find them, though I wold expect it to say if this was the problem.

Are you able to build the exampes which come with PolyVox?

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