MFC: Multi-threaded DLL Errors & Related Syntax :: C++

Status
Not open for further replies.
Hi.

I am studying MFC from Jeff Promise's book. I had problems compiling the first sample MFC program from Prosis because I need to set the project from "single-threaded" to "multi-threaded."

First, "multi-threaded" works, but the execute is huge, maybe five-folds from my biggest win32 console program with many more lines of code. The size of "multi-threaded" un debug mode was 1.5mb. There are less than 100 lines of code. I tried to set "multi-threaded" to "multi-threaded DLL," but then Visual C++ would not compile the source . It responded with a bunch of errors. Do I need to install anything before using the multi-threaded DLL mode?

How does MFC works as far as software release? Let say I give the MFC program to a friend. Will the friend be able to run it? Is MFC/C++ similar to Java and VB where the program comes require specific system DLL?

Lastly, Promise's book is exceptional because it touches everything about MFC. I found some MFC syntax that are not like C++ (or maybe it is just my inexperience). For example, some derived functions return "BOOL" and "TRUE." I know C++'s "bool" and "true." I replaced "TRUE" with "true," and that worked okay. However, Visual C++ came up with errors when I replaced "BOOL" with "bool." Are syntax like th ones above MFC specific and are required?

Kuphryn
 

earl

Well-known member
3,066
Nobody has the debug versions of the libs on their machines; it is illegal to distribute them. You have to do a release build. The size of the executable will also shrink several orders of magnitude.

Note that all the project settings are duplicated and distinct for release and debug builds.

And you have to use the windows BOOL; they are not generally compatible with C++ bool.

-earl-
 
Okay. I tested two versions of multi-threaded DLL.

multi-threaded DLL (DEBUG): Here are the errors when I tried to compile.
----------
-----
Hello error LNK2001: unresolved external symbol ___argc
-----
Hello error LNK2001: unresolved external symbol ___argv
-----
Hello error LNK2001: unresolved external symbol __mbctype
-----
Hello error LNK2019: unresolved external symbol __mbctype referenced in function "public: void __thiscall CEditView::ReadFromArchive(class CArchive &,unsigned int)" (?ReadFromArchive@CEditView@@QAEXAAVCArchive@@I@Z)
-----
Hello error LNK2019: unresolved external symbol __mbctype referenced in function "void __stdcall AfxFormatStrings(class ATL::CStringT<char,class StrTraitMFC<char,class ATL::ChTraitsCRT<char> > > &,unsigned int,char const * const *,int)" (?AfxFormatStrings@@YGXAAV?$CStringT@DV?$StrTraitMFC@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@IPBQBDH@Z)
-----
Hello fatal error LNK1120: 3 unresolved externals
-----
----------

multi-threaded DLL: Here are the errors when I tried to compile.

----------
-----
Hello error LNK2001: unresolved external symbol ___argc
-----
Hello error LNK2001: unresolved external symbol ___argv
-----
Hello error LNK2001: unresolved external symbol __mbctype
-----
Hello error LNK2019: unresolved external symbol __mbctype referenced in function "public: void __thiscall CEditView::ReadFromArchive(class CArchive &,unsigned int)" (?ReadFromArchive@CEditView@@QAEXAAVCArchive@@I@Z)
-----
Hello error LNK2019: unresolved external symbol __mbctype referenced in function "void __stdcall AfxFormatStrings(class ATL::CStringT<char,class StrTraitMFC<char,class ATL::ChTraitsCRT<char> > > &,unsigned int,char const * const *,int)" (?AfxFormatStrings@@YGXAAV?$CStringT@DV?$StrTraitMFC@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@IPBQBDH@Z)
-----
Hello fatal error LNK1120: 3 unresolved externals
-----
Hello warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
-----
----------

I would like to compile MFC using multi-threaded DLL, thus making the program smaller.

Thanks,
Kuphryn
 
Status
Not open for further replies.