LNK2019: unresolved external symbol problem

I have some plugin source for 3ds max v7 and i want to compile it for version 9. Ive found 3ds max 9 sdk and all necessary libraries but when i try to compile it throws me these errors:

...\wingdi.h(3157): error C2146: syntax error : missing ';' before identifier 'otmTextMetrics'
...
...


Maybie i am mising some options as wingdi.h should not throw error it is part of windows sdk.

EDIT: Back to earlier version of Visual studio (vs 2010 previously tried with 2011) and now got linker errors:

...error LNK2019: unresolved external symbol __imp__NewtonDestroy referenced in function "public: virtual int __thiscall MaxDll::DoExport
...// and more similar functions used from Newton library

I dont understand why? I have setup all necessary paths and includes, the dll is formed from 3 simple source files:

MaxPlugin.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#pragma once

#ifndef NewtonTreeCollisionPlugin_HEADER_DEFINED
#define NewtonTreeCollisionPlugin_HEADER_DEFINED

#include <Newton.h> // this library function is linker complaining about
#pragma comment(lib,"Newton.lib")

class MaxDll : public SceneExport {
	public:
...
int DoExport(const TCHAR *name,ExpInterface *ei,Interface *i, BOOL suppressPrompts=FALSE, DWORD options=0);
};
...
#endif 


MaxPlugin.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "stdafx.h"

...

static MaxDllClassDesc MaxExporterDesc;
BOOL APIENTRY DllMain( HANDLE hModule, 
                       DWORD  ul_reason_for_call, 
                       LPVOID lpReserved
					 )
{
	return TRUE;
}



 extern "C" __declspec( dllexport ) const TCHAR *LibDescription()
{
	return _T("Plugino aprasymas");
}

 extern "C" __declspec(dllexport) int LibNumberClasses()
{
	return 1;
}

 extern "C" __declspec(dllexport) ClassDesc *LibClassDesc(int i) 
{
	switch(i)
	{
		case 0: return &MaxExporterDesc;
		default: return 0;
	}
}

 extern "C" __declspec( dllexport ) ULONG LibVersion()
{
	return VERSION_3DSMAX;
}

int	MaxDll::DoExport(const TCHAR *name, ExpInterface *ei, Interface *i, BOOL suppressPrompts, DWORD options)
{

   ...//Here i use Newton functions
}


stdafx.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#pragma once
#ifndef StdAfx_HEADER_DEFINED
#define StdAfx_HEADER_DEFINED

#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include <windows.h>
#include <Max.h>
#include <iparamb2.h>
#include <igame.h>
#include <igameobject.h>
// TODO: reference additional headers your program requires here
#pragma comment(lib,"core.lib")
#pragma comment(lib,"maxutil.lib")
#pragma comment(lib,"maxscrpt.lib")
#pragma comment(lib,"paramblk2.lib")
#pragma comment(lib,"igame.lib")

#include "MaxPlugin.h"

#endif


Please help, how to resolve this.
Last edited on
You didn't set right path for linker to search for dll's and libraries required to use those dll's.

lib files required by dll's are not the same as lib files for static linking.

How did you build those 3th party sources? dynamic or static?

anyway if you link your program with dll's you should be aware that you have to provide a preprocessor directive indicating dynamic linking.

Every 3th party library has such option.

for example boost has #define BOOST_ALL_DYN_LINK
while GLFW with OpenGL uses #define GLFW_DLL

What ever library u use you should provide that preprocessor in each translation unit or seting you project in visual studio project property sheet.
Resolved.
I linked against wrong Newton lib. They provided 3 different binaries within their sdk so i choose a wrong one (there was MT lib, MD lib and vs9 lib witch worked fine).
Topic archived. No new replies allowed.