makefile mfc

__040711563a17902392e7

海前 王

Posted on September 5, 2024

makefile mfc
CXX = cl
CXXFLAGS = /MDd /DWIN32 /D_DEBUG /D_WINDOWS /D_UNICODE /DUNICODE /D_AFXDLL
INCLUDE_DIR1 = "C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/include"
INCLUDE_DIR2 = "C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/atlmfc/include"
INCLUDE_DIR3 = "C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A/Include"
LIB_DIR1 = "C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/lib"
LIB_DIR2 = "C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/atlmfc/lib"
LIB_DIR3 = "C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A/Lib"

# 目标文件和可执行文件
OBJ = mfc.obj
SRC = mfc.cpp
EXE = mfc.exe

# 规则
all: $(EXE)
#一直报error LNK2019: 无法解析的外部符号 _WinMain@16,该符号在函数 ___tmainCRTStartup 中被引用 加上/ENTRY:wWinMainCRTStartup就好了
$(EXE): $(OBJ)
    link /nologo /OUT:$(EXE) /SUBSYSTEM:WINDOWS   /ENTRY:wWinMainCRTStartup /NODEFAULTLIB:msvcrt /LIBPATH:$(LIB_DIR3) /LIBPATH:$(LIB_DIR1) /LIBPATH:$(LIB_DIR2) $(OBJ) mfc100ud.lib mfcs100ud.lib msvcrtd.lib kernel32.lib user32.lib gdi32.lib


$(OBJ): $(SRC)
    $(CXX) $(CXXFLAGS) /I$(INCLUDE_DIR1) /I$(INCLUDE_DIR2) /I$(INCLUDE_DIR3) /c $(SRC) /Fo$(OBJ)

clean:
    del $(OBJ) $(EXE)


{
    // 使用 IntelliSense 了解相关属性。 
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "启动",
            "type": "cppvsdbg",
            "request": "launch",
            "args": ["args1","args2"],
            "program": "C:\\Users\\Administrator\\Desktop\\mfcmk\\mfc.exe"
        }
    ]
}


Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
__040711563a17902392e7
海前 王

Posted on September 5, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related