Solved

Errors & Warnings-> How to resolve

Posted on 2004-04-09
3
2,372 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

777 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