It is currently Mon Dec 09, 2019 4:36 pm


All times are UTC




Post new topic Reply to topic  [ 26 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Compiler warnings and errors - Post your fixes here
PostPosted: Mon Jul 04, 2011 9:34 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
This thread is for posting fixes for compile warnings and errors which you encounter when building PolyVox. Please note this is not a support thread - you should not post here if you are unable to build, only if you have overcome some build problems and wish to share your changes with others.

If you are unable to build then you should instead start a new topic in PolyVox Discussion


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Compiler warnings and errors - Post your fixes here
PostPosted: Mon Sep 12, 2011 12:23 am 

Joined: Sat Sep 18, 2010 9:45 pm
Posts: 189
Compiler Error C2872

ambiguous symbol in SurfaceMesh.inl

I have a cpp file which uses the
"using namespace Ogre" directive and it also includes "SurfaceMesh.h"

"SurfaceMesh.inl" has "using namespace std;" by convention we usually shouldn't have the using directive in a header file. But I went ahead and got rid of the using directive in "SurfaceMesh.inl" and adding "using std::vector" in the function "SurfaceMesh<VertexType>::removeUnusedVertices".

Of courser I could have fixed by removing using namespace Ogre from my cpp file.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Compiler warnings and errors - Post your fixes here
PostPosted: Sun Sep 18, 2011 11:36 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Thanks, but actually I fixed this in Git a couple of weeks ago. I was cleaning up the #include hierarchy because there were a lot of redundant includes, and I fixed this at the same time. But thanks anyway :-)


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Compiler warnings and errors - Post your fixes here
PostPosted: Sun Sep 25, 2011 10:39 am 

Joined: Sun Sep 25, 2011 7:36 am
Posts: 13
Hi,

Here's one that fixes some warnings occurring, not when building PolyVox itself, but in clients application.

Cheers

Edit: Attachement don't seem to work for me, so here is the content. Obtained with "git diff". Let me know if some other format, or even a "merge request" is preferred.

Code:
diff --git a/library/PolyVoxCore/include/PolyVoxCore/SurfaceExtractor.inl b/library/PolyVoxCore/include/PolyVoxCore/SurfaceExtractor.inl
index 24b8178..c206c85 100644
--- a/library/PolyVoxCore/include/PolyVoxCore/SurfaceExtractor.inl
+++ b/library/PolyVoxCore/include/PolyVoxCore/SurfaceExtractor.inl
@@ -27,8 +27,8 @@ namespace PolyVox
    SurfaceExtractor<VolumeType, VoxelType>::SurfaceExtractor(VolumeType<VoxelType>* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result)
       :m_volData(volData)
       ,m_sampVolume(volData)
-      ,m_regSizeInVoxels(region)
       ,m_meshCurrent(result)
+      ,m_regSizeInVoxels(region)
    {
       //m_regSizeInVoxels.cropTo(m_volData->getEnclosingRegion());
       m_regSizeInCells = m_regSizeInVoxels;
@@ -524,7 +524,6 @@ namespace PolyVox
             //Current position
             const uint32_t uXRegSpace = m_sampVolume.getPosX() - m_regSizeInVoxels.getLowerCorner().getX();
             const uint32_t uYRegSpace = m_sampVolume.getPosY() - m_regSizeInVoxels.getLowerCorner().getY();
-            const uint32_t uZRegSpace = m_sampVolume.getPosZ() - m_regSizeInVoxels.getLowerCorner().getZ();
 
             //Determine the index into the edge table which tells us which vertices are inside of the surface
             uint8_t iCubeIndex = pPreviousBitmask[uXRegSpace][uYRegSpace];
@@ -618,4 +617,4 @@ namespace PolyVox
          }//For each cell
       }
    }
-}
\ No newline at end of file
+}


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Compiler warnings and errors - Post your fixes here
PostPosted: Sun Sep 25, 2011 12:01 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Thanks, 'git apply' claimed the patch was corrupt but that's probably due to the forum breaking the formatting. It was easy enough just to apply the changes by eye.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Compiler warnings and errors - Post your fixes here
PostPosted: Sun Sep 25, 2011 12:21 pm 
Developer
User avatar

Joined: Sun May 11, 2008 4:29 pm
Posts: 198
Location: UK
Attachments should work here.They will need a .diff or .patch file extension though to pass the forum's filtering.

diff files are notoriously picky about formatting and whitespace so I'm not surprised that copy-pasting didn't work.

Patches made with 'git diff' can be applied with 'git apply' and if you make a patch with 'git format-patch' then we can apply it with 'git am' which will preserve your commit message and the fact that the patch was authoured by you.

_________________
Matt Williams
Linux/CMake guy


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Compiler warnings and errors - Post your fixes here
PostPosted: Sun Sep 25, 2011 1:10 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
milliams wrote:
...and if you make a patch with 'git format-patch' then we can apply it with 'git am' which will preserve your commit message and the fact that the patch was authoured by you.

Ah, that's worth knowing for the future.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Compiler warnings and errors - Post your fixes here
PostPosted: Fri Oct 07, 2011 4:26 am 

Joined: Sat Dec 18, 2010 2:58 am
Posts: 41
When using PolyVox::Density<float> you get a compiler error

Quote:
Error 9 error C2297: '|' : illegal, right operand has type 'float' []PolyVoxCore\include\PolyVoxCore\SurfaceExtractor.inl 445 1


Changing line 63 in Density.h to not use the templated type, but instead to always use int for the material solves the problem.

Code:
int getMaterial() const throw() { return 1; }


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Compiler warnings and errors - Post your fixes here
PostPosted: Fri Oct 07, 2011 9:21 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Agreed, I've made some changes similar to what you have suggested so hopefully it now works for you.

And I'm pleased to hear the SurfaceExtractor works on a float volume - I knew it should in theory but I had never tested it and thought there might be some unexpected issues. So that's good news.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Compiler warnings and errors - Post your fixes here
PostPosted: Sun Oct 09, 2011 12:59 pm 

Joined: Sat Dec 18, 2010 2:58 am
Posts: 41
Ah forgot some other changes I made to make the Density class work with floats

Around line 68 in Density.h for the function getMaxDensity and getThreshold
I changed to

Code:
      static DensityType getMaxDensity() throw() { return std::numeric_limits<DensityType>::max();}
      static DensityType getMinDensity() throw() { return 0; }
      static DensityType getThreshold() throw() {return  (std::numeric_limits<DensityType>::max()/2);}


I have no idea what that voodoo bitwise operators do, but I'm guessing it doesn't work with non int types, so I used std::numeric_limits<> instead. I did a quick test and it seems to be working with both ints and floats.


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


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