Visual Studio 2008 error LNK2019 错误解决办法 ( _tWinMain 12月25日)

在阅读《Windows核心编程 第5版》时,遇到DLL基础章节的代码编译错误。错误源于_tWinMain的未定义,由于工程设置为Unicode字符集但未包含<tchar.h>。解决方法是包含<tchar.h>或更改工程字符集为多字节并使用WinMain。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

        今天看《windows核心编程 第5版》这本书的第19章:DLL基础 ,看到19.2.2节:构建可执行文件 时,编译里面的代码,发现编译通不过。代码如下:

/***************************************************************************
Module:  MyExeFile1.cpp
***************************************************************************/
// Include the standard Windows and C-Runtime header files here.
#include <windows.h>
#include <strsafe.h>
#include <stdlib.h>
// Include the exported data structures, symbols, functions, and variables.
#include "MyLib\MyLib.h"
#pragma comment(lib,"Mydll.lib")
////////////////////////////////////////////////////////////////////////////
int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int) {
	int nLeft = 10, nRight = 25;
	TCHAR sz[100];
	StringCchPrintf(sz, _countof(sz), TEXT("%d + %d = %d"),
		nLeft, nRight, Add(nLeft, nRight));
	MessageBox(NULL, s
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值