How To Use Chipmunk in Visual C++ '08 for your own Projects

Official forum for the Chipmunk2D Physics Library.
codingcarlos
Posts: 1
Joined: Sat Oct 24, 2009 7:06 am
Contact:

Re: How To Use Chipmunk in Visual C++ '08 for your own Projects

Post by codingcarlos »

I'm having the same problem as zzzzrrr, the older version works perfectly in Visual C++ 2008 but I cant get the latest version to build. Any ideas? Below are the errors :)

..\..\Demo\drawSpace.c(225) : error C2057: expected constant expression
..\..\Demo\drawSpace.c(225) : error C2466: cannot allocate an array of constant size 0
..\..\Demo\drawSpace.c(225) : error C2133: 'VAR' : unknown size
..\..\Demo\drawSpace.c(421) : error C2664: 'drawConstraint' : cannot convert parameter 1 from 'void *' to 'cpConstraint *'
Conversion from 'void*' to pointer to non-'void' requires an explicit cast
..\..\Demo\Query.c(184) : error C2057: expected constant expression
..\..\Demo\Query.c(184) : error C2466: cannot allocate an array of constant size 0
..\..\Demo\Query.c(184) : error C2133: 'verts' : unknown size
User avatar
Tam Toucan
Posts: 141
Joined: Tue Jun 23, 2009 4:26 pm
Contact:

Re: How To Use Chipmunk in Visual C++ '08 for your own Projects

Post by Tam Toucan »

Well I don't use VC so I'm no expert, but looking at the first error line it's because Chipmunk is C99 C which allows variable sized arrays to be declared on the stack. C++ does not allow this (g++ allows it via an extension). If VC++ 08 can support variable sized arrays on the stack using some flag I don't know. Google is your fried :)
fk1985
Posts: 7
Joined: Tue Dec 15, 2009 12:50 pm
Contact:

Re: How To Use Chipmunk in Visual C++ '08 for your own Projects

Post by fk1985 »

Hi guys!

I'm new to chipmunk and I'm trying to set it up for the first time.

The latest version 5.0.0 doesn't work for me at all.

The demo from the version 4.1.0 runs properly. Now I'm trying to include chipmunk into my own project...
I have set it up, as described in the first post. (except, I include the source code like Kevin mentioned it, only for the project, not "global")

Now I get the linker error:

Code: Select all

1>Linking...
1>LINK : fatal error LNK1181: cannot open input file 'chipmunk.obj'
which isn't a surprise, because the chipmunk .obj files haven't been built in the release folder (or anywhere else).

How can I build them?

Thanks!
fk1985
Posts: 7
Joined: Tue Dec 15, 2009 12:50 pm
Contact:

Re: How To Use Chipmunk in Visual C++ '08 for your own Projects

Post by fk1985 »

I got it working in the meantime.

First, I copied all compiler flags from the properties. (but I don't trust this approach, because now my "old" code runs weird...)

Added all files to my project and renamed the .c files to .cpp

and made some changes in the .h files. ( inline to __inline etc. )

What's your experience with this approach? As I said, I don't trust the compiler settings.... we will see, I'm giving it a try.
MarkAMalo
Posts: 1
Joined: Tue Dec 15, 2009 4:22 pm
Contact:

Re: How To Use Chipmunk in Visual C++ '08 for your own Projects

Post by MarkAMalo »

Well the latest version does not work for me at all. In fact, the Solution file cannot find any of the demo files (and neither can I when I look into the demo folder, there are none named that way, so I deleted them all and added the ones that are actually there) also there are some headers and class files not found (neither by me, so again I removed those and added the new ones). But it will not compile:

'snprintf': identifier not found
expected constant expression
cannot allocate an array of constant size 0
'VAR' : unknown size
'drawConstraint' : cannot convert parameter 1 from 'void *' to 'cpConstraint *'
'initializing' : cannot convert from 'cpDataPointer' to 'OneWayPlatform *'
'initializing' : cannot convert from 'cpDataPointer' to 'PlayerStruct *'
'initializing' : cannot convert from 'cpDataPointer' to 'PlayerStruct *'
initializing' : cannot convert from 'cpDataPointer' to 'PlayerStruct *'
expected constant expression
cannot allocate an array of constant size 0
.
.
.

Is there some reason why NO ONE can post a compiled version for us to use? I don't need the source code for Chipmunk Physics, I just need the functionality.
- Mark
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: How To Use Chipmunk in Visual C++ '08 for your own Projects

Post by slembcke »

MarkAMalo wrote:Is there some reason why NO ONE can post a compiled version for us to use? I don't need the source code for Chipmunk Physics, I just need the functionality.
From the readme:
Windows: There is an included MSVC project for building the library and demo application. I do not personally maintain the MSVC project. If there are issues with it, please make a post on the forums.
Any help you can give me in terms of a patch would be very helpful. I have no way of building or testing the MSVC project, and I don't personally maintain

I could give you some better help if I knew line numbers or at least files for these errors.
  • snprintf() I thought was a very core part of the standard C library. No idea what the issue is there.
  • Not quite sure why it is being picky about casting void pointer types implicitly, but I fixed that. I normally do it out of habit anyway.
  • "expected constant expression" No clue what or where that would be caused.
  • The unknown array size issue was because MSVC's C compiler is apparently like 20 years old... Fixed that by doing an alloca() instead of an array.
  • No idea where it thinks I'm allocating arrays that are 0 in size.
I commited the fixes I was able to make to SVN, did that fix at least some of the errors?
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
viblo
Posts: 206
Joined: Tue Aug 21, 2007 3:12 pm
Contact:

Re: How To Use Chipmunk in Visual C++ '08 for your own Projects

Post by viblo »

MarkAMalo wrote:
(cut...)

Is there some reason why NO ONE can post a compiled version for us to use? I don't need the source code for Chipmunk Physics, I just need the functionality.
- Mark
If you are happy with a dll compiled with mingw/gcc then Ive one here: http://deepwhite.viblo.se/chipmunk.dll (rev 330) that you can download. However, I have another problem with it as I wrote in the other thread so don't expect it to work perfectly with python/ctypes if that is what you want to use it for.
http://www.pymunk.org - A python library built on top of Chipmunk to let you easily get cool 2d physics in your python game/app
fk1985
Posts: 7
Joined: Tue Dec 15, 2009 12:50 pm
Contact:

Re: How To Use Chipmunk in Visual C++ '08 for your own Projects

Post by fk1985 »

If you are happy with a dll compiled with mingw/gcc then Ive one here: http://deepwhite.viblo.se/chipmunk.dll (rev 330) that you can download. However, I have another problem with it as I wrote in the other thread so don't expect it to work perfectly with python/ctypes if that is what you want to use it for.
the link seems to be down. Could you upload the chipmunk.dll somewhere else? Thanks!
viblo
Posts: 206
Joined: Tue Aug 21, 2007 3:12 pm
Contact:

Re: How To Use Chipmunk in Visual C++ '08 for your own Projects

Post by viblo »

fk1985 wrote:
If you are happy with a dll compiled with mingw/gcc then Ive one here: http://deepwhite.viblo.se/chipmunk.dll (rev 330) that you can download. However, I have another problem with it as I wrote in the other thread so don't expect it to work perfectly with python/ctypes if that is what you want to use it for.
the link seems to be down. Could you upload the chipmunk.dll somewhere else? Thanks!
I have attached it with this post.
http://www.pymunk.org - A python library built on top of Chipmunk to let you easily get cool 2d physics in your python game/app
fk1985
Posts: 7
Joined: Tue Dec 15, 2009 12:50 pm
Contact:

Re: How To Use Chipmunk in Visual C++ '08 for your own Projects

Post by fk1985 »

the .dll didn't work :-(

Anyway, I modified the code to work with Visual Studio 2008.

The package is attached.
(No it isn't... too big)

But the first 10 people can get it from here:
http://rapidshare.com/files/321845174/C ... 0.zip.html
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests