C Board  

Go Back   C Board > General Programming Boards > C++ Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 02-12-2002, 06:35 PM   #1
Registered User
 
Join Date: Nov 2001
Posts: 1,348
MFC: Multi-threaded DLL Errors & Related Syntax :: C++

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
kuphryn is offline   Reply With Quote
Old 02-13-2002, 01:20 AM   #2
the hat of redundancy hat
 
nvoigt's Avatar
 
Join Date: Aug 2001
Location: Hannover, Germany
Posts: 2,821
>I tried to set "multi-threaded" to "multi-threaded DLL," but
>then Visual C++ would not compile the source .

Well, if you don't compile a DLL, then don't set it to DLL.

>How does MFC works as far as software release ?

If you link the MFC statically, you can distribute the .exe without any more DLLs. Just copy the .exe.

>Are syntax like th ones above MFC specific and are required?

They are specific to the windows libraries of Microsoft.

If you write your own functions, you can use what you want.
However, if you override MFC methods, you have to use they way they did it
__________________
hth
-nv

She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

When in doubt, read the FAQ.
Then ask a smart question.
nvoigt is online now   Reply With Quote
Old 02-13-2002, 08:37 AM   #3
Registered User
 
Join Date: Nov 2001
Posts: 1,348
Okay. Thanks.

You were the first person that mentioned compiling a DLL. I did not know I have to compile one. How do you compile one to go with the program?

Lastly, here are the errors Visual C++ came up with when I tried to compile MFC with mode "multi-threaded DLL" install of static multi-threaded.

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?$StrTraitM FC@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?$StrTraitM FC@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
kuphryn is offline   Reply With Quote
Old 02-13-2002, 09:02 AM   #4
Registered User
 
Join Date: Nov 2001
Posts: 1,348
Okay. I figured out the problem. The problem was there were mismatch settings in the project. The probject was default to Applicantion(exe) and Standard Windows Libraries. I had to set the project to use "Shared MFC DLL" instead of Standard Windows Libraries.

The executed size shrinks from 1.5mb to 100k in debug mode.

Kuphryn
kuphryn is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
more then 100errors in header hallo007 Windows Programming 20 05-13-2007 08:26 AM
Couple C questions :) Divx C Programming 5 01-28-2003 01:10 AM
Expression/Declaration Syntax Errors fuh C++ Programming 2 01-15-2003 06:49 PM
DLL version MFC app Unregistered Windows Programming 0 07-30-2002 07:22 PM
MFC Errors :: C++ kuphryn C++ Programming 3 02-11-2002 09:46 AM


All times are GMT -6. The time now is 08:28 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22