I know ... linker errors usually occur because you forgot to include some libraries but in this case I really don't know what is going on. Here is what I did:
- Downloaded Polyvox (latest snapshot) and using CMake I succesfully created the files and solution for Visual C++ 2005
- In Visual Studio 2005 I compiled both PolyVox libraries(Core + Util) succesfully
- I set up a new c++ DLL Project for Visual c++ 2005 and added the Include/Library directories for both Polyvox Libraries.
- I also added Boost to the directories since polyvox uses those smartpointers
- In addition to that I added both PolyVox libraries as Additional Dependencies for Linker Input
(- Later I even tried importing the libraries using #pragma)
- After that I added a few lines of code to my application:
Code:
#include "PolyVoxCore/SimpleVolume.h"
#include "PolyVoxCore/MaterialDensityPair.h"
#include "PolyVoxCore/CubicSurfaceExtractorWithNormals.h"
#include "PolyVoxCore/SurfaceMesh.h"
using namespace PolyVox;
void myclass::somefunction()
{
//Create an empty volume and then place a sphere in it
SimpleVolume<MaterialDensityPair44> volData(Region(Vector3DInt32(0,0,0), Vector3DInt32(63, 63, 63)));
}
As you see that's just a volume I create. There is no other code involving polyvox but this single line(if I remove it everything compiles just fine) generates the following linker errors:
Code:
1>Widget.obj : error LNK2019: unresolved external symbol "public: class PolyVox::Vector<3,int> const & __cdecl PolyVox::Region::getLowerCorner(void)const " (?getLowerCorner@Region@PolyVox@@QEBAAEBV?$Vector@$02H@2@XZ) referenced in function "public: int __cdecl PolyVox::Volume<class PolyVox::MaterialDensityPair<unsigned char,4,4> >::getWidth(void)const " (?getWidth@?$Volume@V?$MaterialDensityPair@E$03$03@PolyVox@@@PolyVox@@QEBAHXZ)
1>Widget.obj : error LNK2019: unresolved external symbol "public: class PolyVox::Vector<3,int> const & __cdecl PolyVox::Region::getUpperCorner(void)const " (?getUpperCorner@Region@PolyVox@@QEBAAEBV?$Vector@$02H@2@XZ) referenced in function "public: int __cdecl PolyVox::Volume<class PolyVox::MaterialDensityPair<unsigned char,4,4> >::getWidth(void)const " (?getWidth@?$Volume@V?$MaterialDensityPair@E$03$03@PolyVox@@@PolyVox@@QEBAHXZ)
1>Widget.obj : error LNK2019: unresolved external symbol "unsigned char __cdecl PolyVox::logBase2(unsigned int)" (?logBase2@PolyVox@@YAEI@Z) referenced in function "public: void __cdecl PolyVox::SimpleVolume<class PolyVox::MaterialDensityPair<unsigned char,4,4> >::Block::initialise(unsigned short)" (?initialise@Block@?$SimpleVolume@V?$MaterialDensityPair@E$03$03@PolyVox@@@PolyVox@@QEAAXG@Z)
1>Widget.obj : error LNK2019: unresolved external symbol "bool __cdecl PolyVox::isPowerOf2(unsigned int)" (?isPowerOf2@PolyVox@@YA_NI@Z) referenced in function "public: void __cdecl PolyVox::SimpleVolume<class PolyVox::MaterialDensityPair<unsigned char,4,4> >::Block::initialise(unsigned short)" (?initialise@Block@?$SimpleVolume@V?$MaterialDensityPair@E$03$03@PolyVox@@@PolyVox@@QEAAXG@Z)
1>Widget.obj : error LNK2019: unresolved external symbol "public: void __cdecl PolyVox::Region::setUpperCorner(class PolyVox::Vector<3,int> const &)" (?setUpperCorner@Region@PolyVox@@QEAAXAEBV?$Vector@$02H@2@@Z) referenced in function "public: void __cdecl 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@@QEAAXAEBVRegion@2@G@Z)
1>Widget.obj : error LNK2019: unresolved external symbol "public: void __cdecl PolyVox::Region::setLowerCorner(class PolyVox::Vector<3,int> const &)" (?setLowerCorner@Region@PolyVox@@QEAAXAEBV?$Vector@$02H@2@@Z) referenced in function "public: void __cdecl 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@@QEAAXAEBVRegion@2@G@Z)
1>Widget.obj : error LNK2019: unresolved external symbol "public: __cdecl PolyVox::Region::Region(class PolyVox::Vector<3,int> const &,class PolyVox::Vector<3,int> const &)" (??0Region@PolyVox@@QEAA@AEBV?$Vector@$02H@1@0@Z) referenced in function "public: virtual void __cdecl Widget::BuildMesh(int)" (?BuildMesh@Widget@@UEAAXH@Z)
1>..\..\..\x64\plugin\widget.dlo : fatal error LNK1120: 7 unresolved externals
So now I honestly don't know what else to try next. Maybe I just forgot to do some stupid step somewhere but no clue. Any ideas?
EDIT: Maybe this has something to do with the INL files Polyvox uses instead of CPP?
Also I tested using Visual C++ 2010 there everything works just fine. So this is probably a VC2005 issue...
Thank you for your help and also for this super awesome Voxel Tool

Syphorlate