Solved

Errors & Warnings-> How to resolve

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
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…
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 member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

895 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

13 Experts available now in Live!

Get 1:1 Help Now