?
Solved

using a private build of MFC

Posted on 1999-11-04
11
Medium Priority
?
361 Views
Last Modified: 2013-11-20
Anyone know how to build and link to a private build of MFC?  I found some info in TN033 on MSDN about how to build the dll, but can find nothing on how to use it once it is built. I have tried to use the generated lib file to link, but I either get hundreds of errors because of redefinition of funcions if I just include my lib (this is because nafxcw.lib has the functions declared and is automatically included) , or several unresolved externals if I force nafxcw.lib to be excluded. I cannot find any documentation on how to properly use a private MFC to build a dll.  My goal is to build a private mfc that I can link to so that rebooting will be less likely when my app is installed.

Thanks in advance.
0
Comment
Question by:ellings
  • 5
  • 5
11 Comments
 
LVL 23

Expert Comment

by:chensu
ID: 2184354
>My goal is to build a private mfc that I can link to so that rebooting will be less likely when my app is installed.

What is this goal? Why don't use static linking if you want to avoid installing additional DLLs?
0
 
LVL 11

Accepted Solution

by:
mikeblas earned 600 total points
ID: 2184369
Before you include AFX.H, you have to define _AFX_NOFORCE_LIBS. Otherwise, MFC will reference its normal libraries.

..B ekiM
0
 

Author Comment

by:ellings
ID: 2186100
I can't use static linking because I also have an extension dll that I am linking to, and I don't want to add this code to all of my other dlls. I still see the same behavior when I define _AFX_NOFORCE_LIBS.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 11

Expert Comment

by:mikeblas
ID: 2186416
> I still see the same behavior when I define _AFX_NOFORCE_LIBS

Then there's something else wrong with one of your other build settings, and you need to figure it out.

..B ekiM
0
 

Author Comment

by:ellings
ID: 2186951
After rechecking all of my settings and using _AFX_NOFORCE_LIBS, I do notice defferent behavior.  Unfortunatley, I still have two unresolved externals, AFX_MSGMAP and _afxPchNil.  Does anyone know what lib file I need to include for these functions?

Thanks...
0
 
LVL 11

Expert Comment

by:mikeblas
ID: 2187151
_afxPchNil is defined in MFC\SRC\STRCORE.CPP. It should be in your rebuilt library.

AFX_MSGMAP is not a symbol; it's a struct tag. If you've got this symbol in an unresolved externals error, there's something badly wrong with your build!

..B ekiM
0
 

Author Comment

by:ellings
ID: 2187256
I am still havig problems.  I built MFC just like described in TN033.  Any idea what I am doing wrong?  Any help would be greatly appreciated.
0
 

Author Comment

by:ellings
ID: 2188438
I changed the preprocessor defines and the only unresolved external that is reported is AFX_MODULE_STATE.  Once again, does anyone know what lib this is in or what flag needs to be added to the defines?

Thanks
0
 

Author Comment

by:ellings
ID: 2188593
I have found that the problem is mfcs42.lib.  If I include this library, I can build my dll fine, but then it is still linked to the original mfc not my rebuilt mfc.  Is it possible to rebuild mfcs42.lib as well?
0
 
LVL 11

Expert Comment

by:mikeblas
ID: 2198335
Again, AFX_MODULE_STATE is not an external symbol--it's the name of a datatype. If you are seeing this as an unresolved external, you've got some _very_ serious problems with your build. (Or, maybe you're just really bad at accurately quoting error messages.)

MFC42S.LIB builds as byproduct of the MFC DLL build process. Unfortunately, the makefiles shipped in MFC\SRC don't base the name of that static lib on the name you've provided with the LIBNAME= macro.

So, you'll always get MFCS42[u][d].LIB even if LIBNAME= implies something else.

..B ekiM
0
 
LVL 11

Expert Comment

by:mikeblas
ID: 2292438
Where does this stand?  It's been more than a month, now...

..B ekiM
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

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

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Is your organization moving toward a cloud and mobile-first environment? In this transition, your IT department will encounter many challenges, such as navigating how to: Deploy new applications and services to a growing team Accommodate employee…
Suggested Courses
Course of the Month4 days, 9 hours left to enroll

601 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