Newton.h is not compilable with C.

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Newton.h is not compilable with C.

Postby drawtree » Sat May 07, 2011 1:06 pm

If I include Newton.h pure C project, it fires many of this error when compiling with GCC or Clang.

/Users/eonil/Work/Trials/newton-integration-test-1/r615 package/Newton.h:214:4: error: must use 'struct' tag to refer to type 'NewtonBoxParam' [3]


Current my file is from r615 (2.34), however equivalent with the file in Google Code now (r619, 2.34).
This problem cause by missing typedef to the nested structs. So this is compiled well with C++, but not with C. I solved this by getting them out and define typedefs.

Code: Select all
   // These structs were nested and now got out. And typedefs are defined.
   typedef struct NewtonBoxParam NewtonBoxParam;
   typedef struct NewtonSphereParam NewtonSphereParam;
   typedef struct NewtonCylinderParam NewtonCylinderParam;
   typedef struct NewtonCapsuleParam NewtonCapsuleParam;
   typedef struct NewtonConeParam NewtonConeParam;
   typedef struct NewtonChamferCylinderParam NewtonChamferCylinderParam;
   typedef struct NewtonConvexHullParam NewtonConvexHullParam;
   typedef struct NewtonConvexHullModifierParam NewtonConvexHullModifierParam;
   typedef struct NewtonCompoundCollisionParam NewtonCompoundCollisionParam;
   typedef struct NewtonCollisionTreeParam NewtonCollisionTreeParam;
   typedef struct NewtonHeightFieldCollisionParam NewtonHeightFieldCollisionParam;
   typedef struct NewtonSceneCollisionParam NewtonSceneCollisionParam;
   typedef struct NewtonCollisionInfoRecord NewtonCollisionInfoRecord;

   // These structs were not nested. Just defined additionally.
   typedef struct NewtonUserMeshCollisionCollideDesc NewtonUserMeshCollisionCollideDesc;
   typedef struct NewtonUserMeshCollisionRayHitDesc NewtonUserMeshCollisionRayHitDesc;
   typedef struct NewtonHingeSliderUpdateDesc NewtonHingeSliderUpdateDesc;
   typedef struct NewtonJointRecord NewtonJointRecord;
   typedef struct NewtonWorldConvexCastReturnInfo NewtonWorldConvexCastReturnInfo;


I don't know side effect of un-nesting the structs. This is just a workaround.
Eonil Hoon Hwangbo
An application developer for iOS / Mac OS X.
drawtree
 
Posts: 21
Joined: Thu May 05, 2011 5:11 am

Re: Newton.h is not compilable with C.

Postby Julio Jerez » Sat May 07, 2011 1:43 pm

Yes I do not thonk newton will build with straight C, It will build a C p[rojetc coipled wi th a C++ compeile whic is, I beleieve what every one does now.
for exmaple It integrate with C#, Objective C, Pascal, Basic, wich all integrate with C bu no with C++.

But if we can fix that that wand make even more comaprible, that is even better.
Do you mean in the union, of the nested declaration?

This update one seems more complicated, can you make a Patch?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton.h is not compilable with C.

Postby drawtree » Sat May 07, 2011 11:01 pm

I attached patched file. Take a look.
Attachments
Newton.h.zip
Patched file.
(10.2 KiB) Downloaded 346 times
Eonil Hoon Hwangbo
An application developer for iOS / Mac OS X.
drawtree
 
Posts: 21
Joined: Thu May 05, 2011 5:11 am

Re: Newton.h is not compilable with C.

Postby aisman » Mon May 23, 2011 2:49 pm

Will it be used with the next newton version?
aisman
 
Posts: 2
Joined: Wed May 18, 2011 5:22 am

Re: Newton.h is not compilable with C.

Postby Julio Jerez » Mon May 23, 2011 3:29 pm

yes the version will have it.
I believe I fixed it and check it in svn, if you sync you should get it.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 2 guests

cron