does the latest ofxBox2d run in 007 with Visual C++ 2010 Express?

I’m trying to get ofxBox2d from Github ( https://github.com/vanderlin/ofxBox2d ) to work with Visual C++ 2010 Express.
Since it may have been made for xCode I would like to ask:
Does it work for anyone?
Should it?

I get this error message which I cannot seem to fix:
[tt]1>c:\of_prerelease_v0070_vs2010\addons\ofxbox2d\lib\triangle\triangle_impl.hpp(365): fatal error C1083: Cannot open include file: ‘sys/time.h’: No such file or directory[/tt]

Try adding this to your header:

  
#define NO_TIMER  

Not sure about this, but you might also need to add:

  
#define CYGWIN  

The error is actually from the Triangle library, not Box2d, you can see where the error is coming from here: https://github.com/vanderlin/ofxBox2d/blob/master/addon/ofxBox2d/lib/triangle/triangle-impl.hpp

Hope that helps.

Thanks Joshua!
I will try out your solution. I still don’t get used to this PreCompiler stuff. =)

How would one go about fixing the array issue like in this old post?
http://forum.openframeworks.cc/t/ofxbox2d-compiling-issue/2793/4

I got it to work setting the “size()-1” to “1000” in the following line but I don’t really know if I broke anything
[tt]b2Vec2 verts[size()-1];[/tt]

I think as long as the value is a constant integer, VCC is ok with it. I don’t have a windows computer, so I have no idea if this will work, but I think it might:

  
const int sz = v.size() - 1;  
b2Vec2 verts[sz];  

This might just be C and not C++, but if that array is at the class scope, i.e. you’re not doing it in the body of a method, I think you have to use the #define, like

  
#define MAX_VERTS 1000  

Hope that helps a little.

Nope, didn’t work. I used to set it very high like at 1000, but I have no idea how this breaks the Triangle library.
It also only seems to happen on Visual C++, the code runs fine in Code Blocks.

Does anyone know what this does to the triangle code?

Yah, gcc, the compiler that CodeBlocks uses, allows variable length arrays, the MS compiler doesn’t.

Also, I guess it’s never going to :confused: http://connect.microsoft.com/VisualStudio/feedback/details/333273/request-for-c99-vla-in-visual-studio

Does using 1000 break things for you or are you just worried that it will?

[quote=“joshuajnoble, post:7, topic:7806”]Does using 1000 break things for you or are you just worried that it will?
[/quote]

Not really, I just wanted to know if I should expect weird stuff to happen because of that value or if it is not a variable array size then would I eventually expect a memory leak or something of which I have no knowledge. :stuck_out_tongue:
Any thoughts? =)

Not really, I just wanted to know if I should expect weird stuff to happen because of that value or if it is not a variable array size then would I eventually expect a memory leak or something of which I have no knowledge. :stuck_out_tongue:
Any thoughts? =)
[/quote]

No worry. Even 32 will be enough cuz b2_maxPolygonVertices is defined as 32 and the array vertices[32] will be copied to b2PolygonShape::m_vertices[32] in shape.Set(verts, size()-1) function later. Since vertices[32] isn’t dynamically allocated, there is no worry for memory leak or other stuff.

I have also finally done creating an empty ofxBox2d project for Visual C++ Express 2010 yesterday.

:o
Thanks for the info! I really wanted to know that so thank you. :slight_smile:

Hi, I am trying to get this to work with VS10, got the sys/timeh error, tryed to #define NO_TIME & #define CYGWIN, but the I get stuck with this error:

  
     
openframeworks\addons\ofxbox2d\libs\triangle\dpoint.hpp(337): error C3861: 'MyAssertFunction': identifier not found  
       c:\users\paulo barcelos\lab\openframeworks\addons\ofxbox2d\libs\triangle\dpoint.hpp(336) : while compiling class template member function 'reviver::dpoint<NumType,D>::dpoint(void)'  
          with  
          [  
              NumType=double,  
              D=2  
          ]  
          c:\users\paulo barcelos\lab\openframeworks\addons\ofxbox2d\libs\triangle\dpoint.hpp(615) : see reference to class template instantiation 'reviver::dpoint<NumType,D>' being compiled  
          with  
          [  
              NumType=double,  
              D=2  
          ]  
  

Does anyone have a clue what it could be? Or even better, woud it be possible for anyone to share a an empty, compiling, VS10 project? Would be a lifesaver…

Hi There ! @paulobarcelos not sure if you solved your problem but I ran into the same issue. I was able to get ofxBox2D to compile by commenting out all the lines with “assert”

really don’t remember what i did,anyway,here’s the vs2010 project. as far as i recall its not working with debug mode but fine with released. the easiest way is that you can created myApp folder within the apps folder,then put it there,should be working.

box2D_examples.zip

Thanks for the feedback @benMcChesney & @liquid!
I ended up not going for windows at all in the end… I was for the better… :slight_smile:
The only reason I needed it was because I was using the Kinect SDK… so I ended up with 2 computers in my installation, a pc handling the kinect, connected via osc to a mac, where box2d and all the graphics were being processed.