It is currently Sat Aug 22, 2020 3:42 pm


All times are UTC




Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Unresolved External Symbols
PostPosted: Thu Sep 01, 2011 3:24 pm 

Joined: Thu Sep 01, 2011 2:36 pm
Posts: 27
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


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Unresolved External Symbols
PostPosted: Thu Sep 01, 2011 8:32 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
This is strange, and I don't have a very good answer for you. Most of PolyVox is contained in the .h/.inl files (.inl are basically headers) but a small amount of code is in .cpp, such as the Region class which seems to be the problem here. A couple of things to check:

Are you building static or dynamic libraries? You should be able to tell this by the name of the main PolyVoxCore project in the solution - if it's static the project will be called 'PolyVoxCoreStatic'. I think static is the default and should simplify linking.

If you have dynamic linking then it could be an issue with the symbols being exported/imported... we have the POLYVOX_API macro which is supposed to take care of this. Maybe it has a problem on VS2005?

Did you try building the examples which came with PolyVox? Or even cut one of the examples down (if you don't have Qt installed) just to see if it compiles... I wonder whether CMake is adding some strange flag which you then have to match in your project.

Beyond that I'm not really sure... I'm just working with VS2010 here.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Unresolved External Symbols
PostPosted: Thu Sep 01, 2011 9:20 pm 

Joined: Thu Sep 01, 2011 2:36 pm
Posts: 27
Thank you for your quick response David.
Well yes I built static libraries. And I didnt compile your examples because I don't have(and don't want to have ;-) ) this Qt. But I set up a simple application in VC++2005 and copied your example code there and it is the same thing same errors. So it has to be VC2005.

Don't worry though I will also use Visual C++ Express 2010 now which works fine. But one more thing, maybe I should give you some background information on why I was forced to use VC2005.

I want to write a voxel-terrain creation plugin for 3DS MAX. Now applications such as 3DS MAX use a lot of memory so it's better to use a 64bit version of these applications. And since my 3ds max is 64bit I have to compile 64bit and I was too lazy at first to download the Windows Platform SDK which you need when you want to compile 64bit with express 2010.
Wheras in my Vc2005 64bit compiler was already installed and working and all.

But the main issue is that if you want to write a plugin for 3ds max you need to use MFC for the dialogs and all. And Visual C++ 2010 Express doesn't have support for MFC :-(

So what you have to do then is to get the MFC include/lib/src some other way, like painfully extract the right files from visual studio or download it from the web or so :-(

But from now on I'll use vc 2010 too. Thanks again and consider the problem solved, at least for me it is ;-)


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Unresolved External Symbols
PostPosted: Thu Sep 01, 2011 9:49 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Yeah, I can see that's a pain. We have automated tests to keep GCC running but nothing for other compilers unfortuantly.

There may be one other possibility - PolyVox isn't huge so you may be able to just copy the files into you project. In fact, I guess you only need to copy in the .cpp files - it can still include the headers from wherever they are. That way you should avoid any linking issues...


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Unresolved External Symbols
PostPosted: Fri Sep 02, 2011 9:05 am 

Joined: Thu Sep 01, 2011 2:36 pm
Posts: 27
That is a great idea. Maybe I'll do that when I run into other probelems with express. Thanks again and keep up the great work !


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Unresolved External Symbols
PostPosted: Fri Sep 02, 2011 12:59 pm 

Joined: Thu Sep 01, 2011 2:36 pm
Posts: 27
HA! I got it working using a simple trick! I just compiled the polyvox static libraries using visual c++ 2010 and my DLL Plugin using Visual C++ 2005. There's a compiler warning since mismatching VC Versions isn't good praxis. But the linker errors are gone and my plugin works perfectly.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Unresolved External Symbols
PostPosted: Sat Sep 03, 2011 7:15 am 

Joined: Thu Sep 01, 2011 2:36 pm
Posts: 27
Unfortunatly when using Visual C++ 2005 I can't use LargeVolumes because the boost::function thing doesn't work. I always get syntax errors there :(


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Unresolved External Symbols
PostPosted: Sat Sep 03, 2011 11:25 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
How big do you want your volumes to be? Using the SimpleVolume you can probably go up to 1000x1000x1000 or so (this would use 1Gb of memory), and I imagine this would be enough for a MAX plugin?

If you do want to use the LargeVolume what kind of syntax errors do you get (not that I'm that great with boost::function so I may not be able to help...)


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Unresolved External Symbols
PostPosted: Sat Sep 03, 2011 12:04 pm 

Joined: Thu Sep 01, 2011 2:36 pm
Posts: 27
I disabled all paging stuff in the library and took out the boost-function stuff and now it works...
Sure I could use Simple Volume but I thought maybe LargeVolume has some improvements to speed up editing?

Also for some reason I got different geometry for a perlin noise terrain when I switched from SimpleVolume to LargeVolume. So I really don't know what the internal differences are between those two other than the paging stuff.

I also found your mesh decimator didn't work 100% correctly but I found out that the 3ds max vertex weld modifier does a great job unifying the meshs topology. Also 3ds max pro optimizer and multi res modifier are great to simplify the geometry. And you can get rid of those typical marching cubes geometry artifacts(those little bumps) by smoothing the terrain using the relax brush of editablepoly modifier.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Unresolved External Symbols
PostPosted: Sat Sep 03, 2011 12:50 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Syphorlate wrote:
Sure I could use Simple Volume but I thought maybe LargeVolume has some improvements to speed up editing?


No, generally I would expect the SimpleVolume to be faster. It has more direct access to the data because there is a fixed number of blocks and the correct one can be found quickly, where as the LargeVolume uses an std::map of a variable size and lookups take more time. I haven't really profiled it though.

Syphorlate wrote:
Also for some reason I got different geometry for a perlin noise terrain when I switched from SimpleVolume to LargeVolume. So I really don't know what the internal differences are between those two other than the paging stuff.


They should be the same... at the moment I'm refactoring the volume code and after that I will add some unit tests to verify behaviour between differnt volumes.

Syphorlate wrote:
I also found your mesh decimator didn't work 100% correctly...

It does have some issues (mostly performance I think). At some point I'll probably rewrite the decimation to be done as part of the extraction process - I already did this for the CubicSurfaceExtractor and it worked much better. But I'm not working with smooth meshes at the moment so it won't happen for a while.

Syphorlate wrote:
...but I found out that the 3ds max vertex weld modifier does a great job unifying the meshs topology. Also 3ds max pro optimizer and multi res modifier are great to simplify the geometry.


It might fail in some cases though - like if you were to break your mesh down into regions and generate a mesh for each one. 3DS Max decimation might not work so well then. Or if you have multiple material in a mesh it might no honour the material boundaries. Well, I'll be interested to know how it works out.

Syphorlate wrote:
And you can get rid of those typical marching cubes geometry artifacts(those little bumps) by smoothing the terrain using the relax brush of editablepoly modifier.


What kind of voxels are you using? Density8? If your input volume has a smooth range of values (rather than being a 'binary' volume) then you should get a smooth mesh anyway.

Glad it's working out for you - hope you can post some screenshots in the showcase forum when you are done :-)


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2, 3  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net