LNK error

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

LNK error

Postby spark-plug » Wed Jul 08, 2009 10:39 am

Hi,

I've got a little problem with including Newton in VC++ 2008:
If I want to create the project, I get this error:

1>Main.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp__NewtonCreate" in function ""void __cdecl spInitiatePhysics(void)" (?spInitiatePhysics@@YAXXZ)".

I know it's in german but I think it's possible to understand...

It's just the smallest possible project: NewtonCreate and NewtonUpdate. I use the Vista 64 bit system, could this cause the problem? (of course I inluded the newton-libs in the x64-folder!)

Thank you!
spark-plug
 
Posts: 13
Joined: Wed Jul 08, 2009 10:28 am

Re: LNK error

Postby Julio Jerez » Wed Jul 08, 2009 10:53 am

Tha usualtly mean you are trying to link a static library tha has DLL linkage.
you can do tow things:
-get the correct Library,
-Define the correct Link const.

in you open the Newton.h file you will see a define _NEWTON_USE_LIB for linking statically
of nothing for DLL linking.

also if you are build a 64 bit project you nee to get the correct libraies. serach the folders they are all there.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: LNK error

Postby spark-plug » Thu Jul 09, 2009 11:33 am

Thank you!

-Define the correct Link const.


how can I do that exactly?


in you open the Newton.h file you will see a define _NEWTON_USE_LIB for linking statically
of nothing for DLL linking.


Yes, I do, should I change sth in the .h or what?
spark-plug
 
Posts: 13
Joined: Wed Jul 08, 2009 10:28 am

Re: LNK error

Postby Julio Jerez » Thu Jul 09, 2009 12:02 pm

You can do it in two ways.
-Add the define to a common header file that you include before Newton this
MyNetwon.H
#define _NEWTON_USE_LIB
#include <Newton.h>


The second way is to added as a Compiler define by going to the properties tap

c/c++->Preprocessor-> Preprocessor Definition

And add the define to the end of the defines the are already there,
This is the way I do it because like this I can make project configuration the let me build using the DLL and the static link libraries without changing code.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: LNK error

Postby spark-plug » Sat Jul 11, 2009 3:46 am

Hm, with solution 1 I get the same error...
...but the compiler knows the newton.h, because if i make the cursor on a newton function, I get the explanation...

What shell I write into the window for solution 2 ?

I use Vista Home 64bit and VC++ 2008 Express.
I included "C:\...\NewtonWin-2.02\NewtonWin-2.02\sdk"(Include-Path) and "C:\...\NewtonWin-2.02\NewtonWin-2.02\sdk\x32\dll_vs9"(Lib-Path)
and I get this problem:
Code: Select all
1>Main.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_NewtonCreate" in Funktion ""void __cdecl spInitiatePhysics(void)" (?spInitiatePhysics@@YAXXZ)".
1>Debug\....exe : fatal error LNK1120: 1 nicht aufgelöste externe Verweise.


Need help.
spark-plug
 
Posts: 13
Joined: Wed Jul 08, 2009 10:28 am

Re: LNK error

Postby spark-plug » Mon Jul 13, 2009 1:51 pm

No ideas?

I can't do sth. else in my game before including newton. Please!
spark-plug
 
Posts: 13
Joined: Wed Jul 08, 2009 10:28 am

Re: LNK error

Postby Julio Jerez » Mon Jul 13, 2009 4:38 pm

Why don’t you make a directory in your project and you copy the files that you need.
For example say the folder is newton:
The you copy files:
Form the apropeiate folders.
If you use VS2008 the tha will be SDK->dll_vs8
For the library, then you copy the newton dll where Visual studio places your executable.
That will save you the aggravation of setting path in visual studio.

That is exactly what I do with the tutorials, you can check it out in the WIKI.
http://newtondynamics.com/wiki/index.php5?title=Tutorials
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 3 guests

cron