Solved

Errors & Warnings-> How to resolve

Posted on 2004-04-09
3
2,380 Views
Last Modified: 2012-08-13
How do I resolve the below?:


PaintHook.cpp(44) : warning C4273: 'CPaintHook::WndProc' : inconsistent dll linkage
PaintHook.cpp(62) : warning C4273: 'CPaintHook::MyBeginPaint' : inconsistent dll linkage
PaintHook.cpp(88) : warning C4273: 'CPaintHook::MyEndPaint' : inconsistent dll linkage
PaintHook.cpp(105) : warning C4273: 'CPaintHook::CPaintHook' : inconsistent dll linkage
PaintHook.cpp(126) : warning C4273: 'CPaintHook::SubClass' : inconsistent dll linkage


LINK : error LNK2020: unresolved token (06000003) PaintHookWrapper.PaintHookEx::SubClass
LINK : error LNK2020: unresolved token (06000004) PaintHookWrapper.PaintHookEx::Within_WM_PRINT
LINK : error LNK2020: unresolved token (0A000019) __imp_??_7CPaintHook@@6B@
LINK : fatal error LNK1120: 3 unresolved externals
0
Comment
Question by:rossryan
  • 2
3 Comments
 
LVL 6

Expert Comment

by:Mafalda
ID: 10796354
'function' : inconsistent DLL linkage
Two definitions in a file differ in their use of dllimport.
The following sample generates C4273:
// C4273.cpp
// compile with: /W1
char __declspec(dllimport) c;
char c;   // C4273, delete this line or the line above to resolve

int main()
{
}
0
 
LVL 6

Assisted Solution

by:Mafalda
Mafalda earned 250 total points
ID: 10796357
Look for the declarations of CPaintHook
0
 
LVL 86

Accepted Solution

by:
jkr earned 250 total points
ID: 10797497
Since the compiler complains about the DLL linkage regarding methods, make sure your _class_ is declared correctly, e.g.

#ifdef _BUILD_DLL
#define DYNLINK __declspec(dllexport)
#else
#define DYNLINK __declspec(dllimport)
#endif

class DYNLINK CPaintHook {

//...
};

and set

#define _BUILD_DLL

when creating the DLL. This will ensure that the compiler "sees" the correct linkage.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question