Solved

Errors & Warnings-> How to resolve

Posted on 2004-04-09
3
2,384 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
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 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.

628 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