MFCWriteProgramDynamic Link Library is required,MFCRelated dynamic libraries includeMfcd42AndMfc42,MFCThe Framework Program has been automatically loaded. How can we introduce a third-party Dynamic Link Library to the project?
The static Link Library first compiles the functions required in the program into machine codes and stores them in*. LibFile. The compiler will go*. LibFind the required functions, and copy the machine code of these functions in the executable file. SetLibLibrary introduction Project, which has the following3Method.
The first method,LibFiles are directly added to the project file list.
InVCOpen"File View"Page, select the project name, right-click the project, and select 【Add files to project] Command, in the pop-up file dialog box to select to addDLLOfLibFile.
The second method is to set 【Project] Menu 【Settings] To loadDLLOfLibFile
Open 【Project] Menu 【Settings], Select 【Link], And thenObject/library modulesIn the text box.DLLOfLibFile.
Method 3: Import precompiled commands
Add pre-compiled commands # Pragma comment (Lib, " *. Lib " ) The advantage of this method is that the conditional precompiled command can be used to link different versions. Lib File. Because, in DebugMethod Lib File is Debug Version, such Regd. Lib In Release Method Lib File time Release Version, such Regr. Lib . When Application DLL Of Lib After the file is loaded DLL Corresponding header file (*. H) In this header file DLLThe function prototype defined in, and then can be used according to the declaration of the function prototype. DLL Functions in,CodeRefer to the following:
Import to WarehouseTest. LibContains files in the root directory of the program.Test. dll.
# Pragma commenct (Lib, "test. lib ")
# Include "test. h"
Import data into the project according to the above methodTest. LibYou can callTestFunction in the library.