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

Compiling PolyVox on VS2008
http://www.volumesoffun.com/phpBB3/viewtopic.php?f=14&t=183
Page 1 of 1

Author:  Jcrubio [ Fri Mar 25, 2011 1:02 pm ]
Post subject:  Compiling PolyVox on VS2008

I keep getting syntax errors when compiling PolyVoxCore, all related with the header of the class AStarPathFinder. Well I'm sure it's some stupid thing... but I'm struggling for a while with no success... it seems some problem with the template declaration. Any ideas?

error C2061: syntax error : identifier 'function' PolyVox\library\PolyVoxCore\include\AStarPathfinder.h(137) : see reference to class template instantiation 'PolyVox::AStarPathfinderParams<VoxelType>' being compiled
\PolyVox\library\PolyVoxCore\include\AStarPathfinder.h(66) : error C2059: syntax error : ')'
\PolyVox\library\PolyVoxCore\include\AStarPathfinder.h(66) : error C2143: syntax error : missing ')' before ':'
\PolyVox\library\PolyVoxCore\include\AStarPathfinder.h(129) : error C2143: syntax error : missing ';' before '<'
\PolyVox\library\PolyVoxCore\include\AStarPathfinder.h(129) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
\PolyVox\library\PolyVoxCore\include\AStarPathfinder.h(129) : error C2238: unexpected token(s) preceding ';'
\PolyVox\library\PolyVoxCore\include\AStarPathfinder.h(136) : error C2143: syntax error : missing ';' before '<'
\PolyVox\library\PolyVoxCore\include\AStarPathfinder.h(136) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
\PolyVox\library\PolyVoxCore\include\AStarPathfinder.h(136) : error C2238: unexpected token(s) preceding ';'

Author:  David Williams [ Fri Mar 25, 2011 5:38 pm ]
Post subject:  Re: Compiling PolyVox on VS2008

PolyVox uses parts of the upcoming C++0X standard (such as function) which are not provided by VS2008 (only VS2010). You should be able to work around this by using Boost. PolyVox doesn't use 'function' directly, instead it declares a typedef 'polyvox_function' in TypeDef.h which uses std::function when it's available and boost::function when it's not.

Make sure you have boost installed and that it's being found. If this doesn't work, it's possible that the boost::function syntax is different from the std::function syntax. I've never checked this because I don't use boost - I just hoped it would work. If you're good with boost then maybe you can work it out...

Failing that, the easiest solution is to edit 'library\PolyVoxCore\CMakeLists.txt' and remove 'include/AStarPathfinder.h' and 'include/AStarPathfinder.inl' and 'source/AStarPathfinder.cpp'. That should work for now because nothing else depends on those files. However, in the future we are making more use of 'function'.

Author:  Jcrubio [ Sun Mar 27, 2011 10:17 am ]
Post subject:  Re: Compiling PolyVox on VS2008

Thanks for the quick reply... I'm compiling polyvox in three different operating systems, so I had to remove the C++0x feature that was not running in OSX, and use boost instead. I realized that in the file TypeDef.h, the header in line 48:

#include <boost/functional.hpp>

does not include the boost::function and there's an error. That was the reason why the compiler complained about AStarPathFinder. I solved it by including instead,

#include <boost/function.hpp>

I wonder if that was a typo or a silly mistake. Or maybe my boost version (1_44) has slightly changed the location of the "function wrapper".

Author:  David Williams [ Sun Mar 27, 2011 11:00 am ]
Post subject:  Re: Compiling PolyVox on VS2008

It's just a mistake... I don't use Boost myself so I would probably just have guessed what the header file was called. So all you have to do is change that header and it works properly with Boost? I will make that change to SVN when I am back at my development machine.

Author:  Jcrubio [ Sun Mar 27, 2011 11:30 am ]
Post subject:  Re: Compiling PolyVox on VS2008

Yes that's it... I got it compiled in Mac OS X Leopard and samples running fine. :D

Author:  David Williams [ Sun Mar 27, 2011 7:21 pm ]
Post subject:  Re: Compiling PolyVox on VS2008

Ok, I've committed this to the trunk (untested). Thanks for the heads up :)

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