Unresolved ezternals

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Unresolved ezternals

Postby Leadwerks » Thu Apr 06, 2017 12:36 pm

I'm importing the following libraries into a C++ project, but I still get a ton of unresolved externals.

dNewton_d.lib
dScene_d.lib
dCustomJoints_d.lib
dContainers_d.lib
dMath_d.lib
dAnimation_d.lib

Error LNK2001 unresolved external symbol _NewtonCreateNull
Error LNK2001 unresolved external symbol _NewtonCollisionCreateInstance
Error LNK2001 unresolved external symbol _NewtonCollisionSetScale

And lots more. What is the correct way to import the Newton DLL?
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm

Re: Unresolved ezternals

Postby Leadwerks » Thu Apr 06, 2017 1:21 pm

User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm

Re: Unresolved ezternals

Postby Leadwerks » Thu Apr 06, 2017 2:17 pm

I removed the NEWTON_STATIC_LIB define and I still get the same errors. Here are all my defines:

_TIMESPEC_DEFINED
__STEAM__
INDIE_EDITION
FT2_BUILD_LIBRARY
LEADWERKS_3_1
DG_DISABLE_ASSERT
WINDOWS
PSAPI_VERSION=1
WIN32
OS_WINDOWS
DEBUG
PLATFORM_WINDOWS
OPENGL
_WIN_32_VER
_LIB
DG_USE_NORMAL_PRIORITY_THREAD
_NEWTON_BUILD_DLL
PTW32_BUILD
PTW32_STATIC_LIB
_DEBUG
CURL_STATICLIB
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm

Re: Unresolved ezternals

Postby Julio Jerez » Thu Apr 06, 2017 4:55 pm

if you want to build a DLL you need to open any of the dll solution, or projects like
../newton-dynamics\packages\projects\visualStudio_2015_dll/build

changing defined of a type of project to another can do it but is a low of works.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Unresolved ezternals

Postby Leadwerks » Thu Apr 06, 2017 5:02 pm

I did that, without changing the project at all. Now I am trying to import that DLL / lib into another VS project so I can use it.

I need to access the main Newton C commands, as well as the custom joints library,
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm

Re: Unresolved ezternals

Postby Julio Jerez » Thu Apr 06, 2017 7:16 pm

I do not know anything about VS 2017 an dI am no planning to buy a version.

last time I try to set up the community version I get errors, I though it was because my computer, but since them have a new system withe a new version for window 10 professional and I still get the same errors
The product failed to install the listed workloads and components due to one or more package failures.

Incomplete workloads
Desktop development with C++ (Microsoft.VisualStudio.Workload.NativeDesktop,version=15.0.26403.0)

Incomplete components
C++ profiling tools (Microsoft.VisualStudio.Component.VC.DiagnosticTools,version=15.0.26208.0)
Graphics debugger and GPU profiler for DirectX (Microsoft.VisualStudio.Component.Graphics.Tools,version=15.0.26208.0)
Visual C++ core desktop features (Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core,version=15.0.26323.1)
Visual Studio C++ core features (Microsoft.VisualStudio.Component.VC.CoreIde,version=15.0.26208.0)

You can search for solutions using the information below, modify your selections for the above workloads
...
..
...



this VS 2017 seems a departure from 2010, 12, 13 and 15, so I predict it will be * for a least five years like Visual studio 2005 was, so I am not planning to paid 500 buck for a copy.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Unresolved ezternals

Postby Leadwerks » Thu Apr 06, 2017 7:34 pm

I don't use 2017, I use 2015. I tried to create a new project but I still get the same errors. Extract this to the main Newton directory and it will load all the files.
NewtonTest.zip
(132.23 KiB) Downloaded 313 times

Here is what I did:

1) Created a new Visual Studio 2015 console application.

2) Replaced the main source file with this:
Code: Select all
#include "../..\coreLibrary_300\source\newton\Newton.h"
#include "../../packages/dCustomJoints/dCustomBallAndSocket.h"
#include "../../packages/dCustomJoints/dCustomHinge.h"
#include "../../packages/dCustomJoints/dCustomJoint.h"
#include "../../packages/dCustomJoints/dCustomKinematicController.h"
#include "../../packages/dCustomJoints/dCustomSlider.h"
#include "../../packages/dCustomJoints/dCustomSliderActuator.h"
#include "../../packages/dCustomJoints/dCustomHingeActuator.h"
#include "../../packages/dCustomJoints/dCustomJointLibraryStdAfx.h"
#include "../../packages/dCustomJoints/dCustomControllerManager.h"
#include "../../packages/dCustomJoints/dCustomVehicleControllerManager.h"

int main()
{
   NewtonCreate();
    return 0;
}


3) Added these header search paths:
../..\packages\thirdParty\timeTracker
..\../packages\dMath
..\../packages\dContainers
..\../packages\dCustomJoints
../../packages\thirdParty\pthreads.2
..\../coreLibrary_300\source\openCL
..\../coreLibrary_300\source\core
..\../coreLibrary_300\source\meshUtil
..\../coreLibrary_300\source\pthreads.2
..\../coreLibrary_300\source\ampPhysics
../../coreLibrary_300\source\physics
..\../coreLibrary_300\source\newton

4) Added these library inputs:
dNewton_d.lib
dCustomJoints_d.lib

5) Added these library search paths:
..\../packages\projects\visualStudio_2015_dll\Win32\dCustomJoints\debug
..\../packages\projects\visualStudio_2015_dll\Win32\dNewton\debug;%(AdditionalLibraryDirectories)

And this is the result:
1>------ Build started: Project: NewtonTest, Configuration: Debug Win32 ------
1> NewtonTest.cpp
1>NewtonTest.obj : error LNK2019: unresolved external symbol __imp__NewtonCreate referenced in function _main
1>NewtonTest\Debug\NewtonTest.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm

Re: Unresolved ezternals

Postby Leadwerks » Thu Apr 06, 2017 8:31 pm

Okay, I think I am on the right track now. The main Newton library is newton_d.lib, and the search path should be "..\..\coreLibrary_300\projects\windows\project_vs2015_dll\Win32\newton\Debug".

I have this app building now:
Code: Select all
int main()
{
   dFloat pinsAndPivotChildFrame[16];
   NewtonBody* child = NULL;
   dCustomJoint* joint = new dCustomHinge(pinsAndPivotChildFrame, child);
   NewtonCreate();
    return 0;
}
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm

Re: Unresolved ezternals

Postby Julio Jerez » Thu Apr 06, 2017 8:44 pm

you are missing the path for the newton dll

linker->General->
../../coreLibrary_300\projects\windows\project_vs2015_dll\Win32\newton\debug

and you are not adding the core dll,

linker->Imput->
Newton_d.lib
dNewton_d.lib
dCustomJoints_d.lib

you also need to add some of the helper library like the dContainers and dMath
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Unresolved ezternals

Postby Leadwerks » Thu Apr 06, 2017 10:15 pm

Thanks, I've got it working now. I'll be able to send you Leadwerks Engine examples you can debug from VS.

Everything seems to be working so far, except the vehicles changed a lot and will need some work to get running again.
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 11 guests