C / MinGW

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

C / MinGW

Postby 3TATUK » Fri Sep 06, 2013 12:02 am

I would like to try to use Newton but there are two major issues.

First off is just compiling Newton itself.

Problem is, I'm on Windows.. But you only support MSVC? That's sad. I'm sure a lot more developers than me would like to compile Newton with MinGW.

That's my first request.

Second is a better C API. I took a quick look at the source and noticed some extern "C"{ which is good... But I recall trying to include Newton.h and there were a lot of undefined errors, mainly I think for structs which were need to be, but are not, typedef'd. That would be a simple fix. Also in the C tutorial I saw that a previous version was more C-friendly and (possibly other than the struct typedef) C++ features were introduced in a newer version. Not sure how hard it would be to expose a proper C API, but I think it'd be nice.

Most of the simple widely-used open source library projects are compatible with both C and C++ and I think Newton would benefit from this, as the only other real game player is Bullet - and that doesn't have a C API either.

"Think freetype, glfw, pthreads, openssl, SDL, GLEW, mpg123, libpng, enet, etc etc."

So to recap.

Please.

1. MinGW
2. C

Thanks. x} :mrgreen:
3TATUK
 
Posts: 22
Joined: Thu Sep 05, 2013 11:55 pm

Re: C / MinGW

Postby Julio Jerez » Fri Sep 06, 2013 6:29 am

I do not know what you are talking about.
Newton has a POSIT make file that build on Linux, plus Newton has a C interface. Plsu has a Cmake file to build the libraries.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: C / MinGW

Postby 3TATUK » Fri Sep 06, 2013 9:28 pm

Maybe the ABI but not the API?

When trying to include Newton.h:

error: unknown type name 'NewtonUserMeshCollisionCollideDesc'
error: unknown type name 'NewtonUserMeshCollisionRayHitDesc'
error: unknown type name 'NewtonCollisionInfoRecord'
error: unknown type name 'NewtonHingeSliderUpdateDesc'
error: unknown type name 'NewtonHingeSliderUpdateDesc'
error: unknown type name 'NewtonHingeSliderUpdateDesc'
error: unknown type name 'NewtonHingeSliderUpdateDesc'
error: unknown type name 'NewtonJointRecord'

etc.

Also, the linux POSIX makefile doesn't work on MinGW/Windows.

And I don't see the cmake files?
3TATUK
 
Posts: 22
Joined: Thu Sep 05, 2013 11:55 pm

Re: C / MinGW

Postby Julio Jerez » Fri Sep 06, 2013 10:27 pm

3TATUK wrote:error: unknown type name 'NewtonUserMeshCollisionCollideDesc'
error: unknown type name 'NewtonUserMeshCollisionRayHitDesc'
error: unknown type name 'NewtonCollisionInfoRecord'
error: unknown type name 'NewtonHingeSliderUpdateDesc'
error: unknown type name 'NewtonHingeSliderUpdateDesc'
error: unknown type name 'NewtonHingeSliderUpdateDesc'
error: unknown type name 'NewtonHingeSliderUpdateDesc'
error: unknown type name 'NewtonJointRecord'
And I don't see the cmake files?


the cMake is in teh root fordel, plus those types are all legal C declarations, not C++.
Migwin use GCC the spudl compiler fine, because they all byidl woth CGG, LLVC, Visaul studio and Intel
I remember long time ago that I did get the Posit make file to build on MigC, but that is too much work for me.

has you tried to building ot with G++? instead of GCC
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: C / MinGW

Postby Julio Jerez » Fri Sep 06, 2013 10:32 pm

3TATUK wrote:I took a quick look at the source and noticed some extern "C"{ which is good... But I recall trying to include Newton.h and there were a lot of undefined errors, mainly I think for structs which were need to be, but are not, typedef'd. That would be a simple fix.


can you give an exampel of how to change any of thso declarations so that is compatible with your compiler,
because as I recall I has never change dthem and I do remeber building Newton with CGG.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: C / MinGW

Postby 3TATUK » Fri Sep 06, 2013 11:29 pm

I think you just set a typedef alias for all of them - but there's a lot so I haven't bothered trying them all to see if there are other issues.

I probably would if I could even compile Newton itself - but like I said I see no cmake files and the Linux makefile doesn't work on MinGW. :(

Basically trying to compile Newton on windows with GCC.

typedef NewtonUserMeshCollisionCollideDesc NewtonUserMeshCollisionCollideDesc;
typedef NewtonUserMeshCollisionRayHitDesc NewtonUserMeshCollisionRayHitDesc;
typedef NewtonCollisionInfoRecord NewtonCollisionInfoRecord;
typedef NewtonHingeSliderUpdateDesc NewtonHingeSliderUpdateDesc;
typedef NewtonHingeSliderUpdateDesc NewtonHingeSliderUpdateDesc;
typedef NewtonHingeSliderUpdateDesc NewtonHingeSliderUpdateDesc;
typedef NewtonHingeSliderUpdateDesc NewtonHingeSliderUpdateDesc;
typedef NewtonJointRecord NewtonJointRecord;
3TATUK
 
Posts: 22
Joined: Thu Sep 05, 2013 11:55 pm

Re: C / MinGW

Postby Julio Jerez » Sat Sep 07, 2013 7:09 am

I do not know what you are compiling, the cMake file is there.

and those types do compile with CGG, they do on Linux, OSX, and all mobile platforms.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: C / MinGW

Postby 3TATUK » Sat Sep 07, 2013 9:50 am

What's so confusing? Try compiling with GCC and you get those unknown type errors. *gcc* not *g++*

Also the only cmake I see is this:
./applications/newtonModelEditor/addInPlugins/dCollada/pcre-8.01/cmake_install.cmake
./applications/newtonModelEditor/addInPlugins/dCollada/pcre-8.01/CTestTestfile.cmake

Or can you enlighten me?

Maybe you're not listening. Compiling, linking, and including Newton on WINDOWS with GCC included with MINGW. :evil:
3TATUK
 
Posts: 22
Joined: Thu Sep 05, 2013 11:55 pm

Re: C / MinGW

Postby Julio Jerez » Sat Sep 07, 2013 9:57 am

this is the project file.
project.png
project.png (42.01 KiB) Viewed 8656 times


the last file is a CMake project

I said you need to use G++ because internally newton si a C++ project, CPP will not compile it, not even in Linux
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: C / MinGW

Postby 3TATUK » Sat Sep 07, 2013 11:37 am

That cmake files aren't in the RAR version up for download from the google code project page - FYI.

And that was sort of my "request" - Make Newton C compatible x}

Thanks anyway I guess
3TATUK
 
Posts: 22
Joined: Thu Sep 05, 2013 11:55 pm

Re: C / MinGW

Postby Julio Jerez » Sat Sep 07, 2013 11:44 am

but that will requite to write the engine in C. why would any one want to do that? when all you have to do is change the name of the compiler in the make file.
There are people how are using Newton in language that only allow C, like Go. I do not know why you can not compile it

Google do not permit to upload download. and very soon will no allow more uploads.
that why I am not uploading the archives to google code anymore, all downloads are in Google Drive.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: C / MinGW

Postby JoeJ » Sat Sep 07, 2013 12:29 pm

Guess you caught an older version of newton?

The newest svn is here:
http://code.google.com/p/newton-dynamic ... e/checkout

and some frequently updeted is here:
http://code.google.com/p/newton-dynamics/downloads/list

See 'Google Code Project' link above :)

Both should contain cmake files.
Its also possible to compile yourself, but you need to know the right preprocessor definitions and for sure use c++.
I do it this way, i could help with definitions, but they are also listed on some 'compile for multiple platforms' thread here in forum.

I'm sure you could compile a lib with c++, and then continue to use it pure c - if there is a real reason for this.
Using cmake sohuld be less work and easier to stay updated.
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: C / MinGW

Postby 3TATUK » Sat Sep 07, 2013 4:21 pm

To clarify... what I mean is I *know* Newton ITSELF has to be compiled with g++... But I'm talking about including Newton.h in a C-only program to compile and link with as C with GCC... Since Julio said it has a C interface. But there's all those missing typedef alias.

Also btw Julio, another possible solution is instead of typedef'ing them to themselves...
Change the format from this:

struct Name {}

to this:

typedef struct {} Name;

... (and, if the struct has a self reference):

typedef struct Name {} Name;

Not sure if it's valid C++ - but that works in C.

Again, none of the RARs, even 3.10, have the Cmake files. I'll check out with SVN and try to compile... and if it works then I'll try to typedef all that * and see if I can include Newton in C. Otherwise return with errors... We'll see. Thanks.
3TATUK
 
Posts: 22
Joined: Thu Sep 05, 2013 11:55 pm

Re: C / MinGW

Postby JoeJ » Sat Sep 07, 2013 4:38 pm

Ah, yes i can remember a little now about those typedef stuff...
Totally forgotten those details over time.
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: C / MinGW

Postby Julio Jerez » Sat Sep 07, 2013 4:51 pm

this: typedef struct NewtonMesh{} NewtonMesh;
I correct in C and C++
this: struct NewtonMesh{} NewtonMesh;
dos not work in C++

but I still do no understand why it does not compile with your version of GCC, because I have bieng using it CGG since 2.2 and it has always compiled that without problems.
all you need to do is edit run the make POSIT file, and replace _POSIX_VER with _MINGW_32_VER

where did you get that MINGW SDK that you are using?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 6 guests