Visual Studio 2008 Link Error for VS6.0 Project

B

beauwlf

Hi Group
I am testing out Visual Studio 2008 Eval..
i tried to recompile my MFC C++ Visual Studio 6.0 EXE project . I get these
link errors.
I can say these errors are linked to EXE function calls to MFC DLL with
CString as parameter.

Error 383 error LNK2019: unresolved external symbol "__declspec(dllimport)
public: void __thiscall CViDlgModLink::SetDataAText(int,int,class
ATL::CStringT said:
(__imp_?SetDataAText@CViDlgModLink@@QAEXHHV?$CStringT@DV?$StrTraitMFC_DLL@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@H@Z)
referenced in function "protected: void __thiscall
CMarkInspectionView::OnViewData(void)"
(?OnViewData@CMarkInspectionView@@IAEXXZ) MarkInspectionView.obj
MarkInspection

Is there any setting that i need to do to solve this link error.
 
G

Giovanni Dicanio

I am testing out Visual Studio 2008 Eval..
i tried to recompile my MFC C++ Visual Studio 6.0 EXE project . I get
these
link errors.
I can say these errors are linked to EXE function calls to MFC DLL with
CString as parameter.

Error 383 error LNK2019: unresolved external symbol "__declspec(dllimport)
public: void __thiscall CViDlgModLink::SetDataAText(int,int,class

It's not clear to me what you mean with "VS 2008 Eval."... is this Visual
Studio 2008 Express Edition?
If so, it does not support MFC.

Or are you mixing VC6 and VC8 C++ code?
Note that the CString class was completely changed from VC6 to VC2008. In
fact, since VC7.1 (VS .NET 2003), CString has been a template class, and
part of ATL (i.e. you can use CString also in non-MFC projects).

Giovanni
 
T

Tom Serface

Assuming you are using the 90 day trial version (which should work) it looks
like you may need to recompile one or more of your consumable libraries.
CStrings changed since 6.0 and you will need to recompile all of your DLL
code.

Tom
 
B

beauwlf

Tom Serface said:
Assuming you are using the 90 day trial version (which should work) it
looks like you may need to recompile one or more of your consumable
libraries. CStrings changed since 6.0 and you will need to recompile all
of your DLL code.

Tom
Yes its the 90days trial version. If i need to recompile all my consumable
lib that means dot Net products are not compatible with Win32/MFC modules ?
Isn't there any work around this ? Can i implement some CString conversion
in the EXE before calling the DLL ?
else i would need to recompile all my dll modules..
 
G

Giovanni Dicanio

If i need to recompile all my consumable lib that means dot Net products
are not compatible with Win32/MFC modules ?

This question is not very clear to me...

If you want to combine .NET managed components with Win32/MFC native
components you have some options...
For example, you may use C++/CLI as a bridging layer between managed .NET
components and native Win32/MFC code.
Or you can wrap your components using COM...
(COM gives you isolation with respect to programming language used to build
the COM component.)

Instead, if you want to mix native DLLs built with different versions of
Visual C++ compiler, then you must pay attention to that.
In general, if the DLLs have a C++ interface, you should rebuild all the
DLLs with the *same* version of the C++ compiler.
Instead, if you have COM DLLs, or DLL with a pure-C interface, you may mix
DLLs built with different C++ compilers.
However, you must be sure that every heap allocation done inside a DLL is
freed in the *same* DLL.

In your example, it seems that you are using the CString class at DLL
interface, which is a template since VC7.1, so you must rebuild the DLLs and
the EXE with the same C++ compiler.

Giovanni
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top