C++ 控制台程序 如何使用 CString类



在VC的控制台程序中使用CString类、CFile类,需要添加头文件<afxwin.h>或者#include<afx.h>。

添加该文件时,如果也包含了<windows.h>,则要求<afxwin.h>在<windows.h>之前包含,否则会出错的。

如:fatal error C1189: #error :  WINDOWS.H already included.  MFC apps must not #include <windows.h>


有时候编译的时候回出现这样的错误:

fatal error C1189: #error :  Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]

解决方案:右键项目->Configuration Properties -> C++ -> Code Generation ->选择 Runtime Library Multi-threaded Debug(/MTD)

如图:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值