Solved

Errors & Warnings-> How to resolve

Posted on 2004-04-09
3
2,366 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
Comment Utility
'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
Comment Utility
Look for the declarations of CPaintHook
0
 
LVL 86

Accepted Solution

by:
jkr earned 250 total points
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now