Fail to compile Newton and Jointlibary in static libary mode

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Fail to compile Newton and Jointlibary in static libary mode

Postby FSA » Mon Aug 06, 2012 3:38 pm

When I compile Newton and JointLibary in Debug not DebugDLL I get *.lib files. Fine. But when I use these *.lib files I get Linker errors in my Project. One of it is NewtonCreateBody is not defined in newton.
What do I wrong?
User avatar
FSA
 
Posts: 322
Joined: Wed Dec 21, 2011 9:47 am

Re: Fail to compile Newton and Jointlibary in static libary

Postby Julio Jerez » Mon Aug 06, 2012 4:32 pm

you can not mix static joint lib with dynamics newton code or viceverse.
you need to use either both as Lib, or both as dll.

you can probably make the jointlibrary a library that links to a newton DLL, but the project are not congired to work that way.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Fail to compile Newton and Jointlibary in static libary

Postby FSA » Tue Aug 07, 2012 7:00 am

I have build all in static mode. Also all in debugmode.
User avatar
FSA
 
Posts: 322
Joined: Wed Dec 21, 2011 9:47 am

Re: Fail to compile Newton and Jointlibary in static libary

Postby Julio Jerez » Tue Aug 07, 2012 8:35 am

they are use as ststic libraries in teh sandbox demos and they work.

make sure that you declare
#define _NEWTON_STATIC_LIB

to use them as static libraries, the default is to use then as DLL as you can see here

Code: Select all
#ifdef _NEWTON_STATIC_LIB
   #define NEWTON_API
#else
   #ifdef _NEWTON_BUILD_DLL
      #ifdef _WIN32
         #define NEWTON_API __declspec (dllexport)
      #else
         #define NEWTON_API __attribute__ ((visibility("default")))
      #endif
   #else
      #ifdef _WIN32
         #define NEWTON_API __declspec (dllimport)
      #else
         #define NEWTON_API
      #endif
   #endif
#endif
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Fail to compile Newton and Jointlibary in static libary

Postby FSA » Tue Aug 07, 2012 3:02 pm

By me it's this code:
Code: Select all
#ifdef _NEWTON_USE_LIB
   #define NEWTON_API
#else
   #ifdef _NEWTON_BUILD_DLL
      #define NEWTON_API __declspec(dllexport)
   #else
      #define NEWTON_API __declspec(dllimport)
   #endif
#endif

_NEWTON_USE_LIB is defined.
User avatar
FSA
 
Posts: 322
Joined: Wed Dec 21, 2011 9:47 am

Re: Fail to compile Newton and Jointlibary in static libary

Postby FSA » Tue Aug 07, 2012 3:20 pm

This is one of my Errors:
error LNK2019: unresolved external symbol "__imp__NewtonTreeCollisionBeginBuild" referenced in function ""public: struct NewtonBody * __thiscall RigidBodyHandler::CreateLevelCollision(struct NewtonWorld *,class Model *,class Matrix)" (?CreateLevelCollision@RigidBodyHandler@@QAEPAUNewtonBody@@PAUNewtonWorld@@PAVModel@@VMatrix@@@Z)".
User avatar
FSA
 
Posts: 322
Joined: Wed Dec 21, 2011 9:47 am

Re: Fail to compile Newton and Jointlibary in static libary

Postby Julio Jerez » Tue Aug 07, 2012 3:57 pm

like I said you build a newton as static library but in your project you did declared define

#define _NEWTON_USE_LIB
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Fail to compile Newton and Jointlibary in static libary

Postby FSA » Sun Aug 12, 2012 7:01 am

No. Doesn't work. I've defined it in my header befor inlucding newton.h and JointLibary.h. Same errors as before.
User avatar
FSA
 
Posts: 322
Joined: Wed Dec 21, 2011 9:47 am

Re: Fail to compile Newton and Jointlibary in static libary

Postby Julio Jerez » Sun Aug 12, 2012 7:38 am

you have to have somethiog wrong in teh project, becau sethey all work. look at teh sanddemo project setting they all use static libraries.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests