1.在程序头添加#include "stdafx.h" 和#include <afx.h>时会出现以下错误

在Win32Project下使用,出现“error C1189: #error :  WINDOWS.H already included.  MFC apps must not #include <windows.h> d:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afxv_w32.h“

解决方法:在stdafx.h里面把“#include <windows.h>”注释掉,在此处添加“#include "afx.h"”;在afxv_w32.h里,确认#include <windows.h>在#include <zmouse.h>前面。

2.VS2010 MFC 动态编译以静态编译发布

VS2010 c++编写的程序在别人的机子运行不了,缺少mfc100u.dll xxx100d.dll等的解决方法

解决方法: 1.将这些dll打包,和应用程序一起发布;

2.采用MFC静态编译;

使用VS2010编译的程序在windows xp中运行时  经常会出现找不到  相关的DLL文件,我们可以使用静态编译的方法把这些运 行依赖文件打包到*.exe中来,以减少对环境的依赖。

一般可以配置一下两项:

1.Project ->Property->Configuration Properties->General->Use of MFC 选择 Use MFC in a Static Library

2.Project ->Property->Configuration Properties->C/C++->Code Generation->Runtime Library 选择Multi-threaded(/MT)

3.出现错误“error LNK2005: _DllMain@12 already defined in dllmain.obj   uafxcwd.lib(dllmodul.obj)”

解决方法“See if you have _AFXDLL and _USRDLL in the preprocessor definitions. Try removing one of them”。

位置:Project->Propertie->C/C++->Preprocessor->Preprocessor Definitions

原句”WIN32;_DEBUG;_WINDOWS;_USRDLL;DATALOG_EXPORTS;%(PreprocessorDefinitions)“把里面_USRDLL删除掉就可以解决此问题。极有可能是加了#include <afx.h>引起这个问题的。

4.错误“ Please use the /MD switch for _AFXDLL builds”

Project ->Property->Configuration Properties->C/C++->Code Generation->Runtime Library,在Runtime Library下选中Multithreaded    DLL或Debug Multithreaded DLL。

5.出现错误信息“error C2059: syntax error : 'constant'”,很有可能是因为#define 定义重复了,如#define ID   32771 ,可以查找工程是否有定义重复的。

VC++遇到的错误汇集的更多相关文章

  1. VC中链接错误,提示string重定义

    VC链接错误,说是string已经有了实现了,只要 rebuild 一下好了. Linking...LINK : warning LNK4075: ignoring '/EDITANDCONTINUE ...

  2. Oracle数据泵(Data Dump)错误汇集

    Oracle数据泵(Data Dump)使用过程当中经常会遇到一些奇奇怪怪的错误案例,下面总结一些自己使用数据泵(Data Dump)过程当中遇到的问题以及解决方法.都是在使用过程中遇到的问题,以后陆 ...

  3. linux C错误汇集

    问题一: 22.c: In function ‘main’:22.c:8:9: error: empty character constant 解决方法:少了空格

  4. Qt 错误汇集贴

    错误: D:\qtprojects\mycom\mycom\mainwindow.cpp:23: error: no matching function for call to 'MainWindow ...

  5. oralce 简单错误汇集。。。。。

    1.ora-12560 TNS:协议适配器错误 实例名被错误修改或者oracle 服务没有正常启动.

  6. 关于VC中的错误处理

    include <exception> try {} cache(exception &e) { cout<<e.what()<<endl; }     但 ...

  7. mysql错误汇集

    [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated.. ...

  8. VC++中出现错误“ error c2065 'printf' undeclared identifier”的处理方法

    原文:http://blog.csdn.net/panpan639944806/article/details/20135311 有两种可能: 1.未加头文件 #include <stdio.h ...

  9. VC++ 2010编译错误 fatal error C1189 error This file requires _WIN32_WINNT to be #defined at least

    打开你的C++工程,找到里面的stdafx.h文件,然后把下面的红色内容替换成绿色的 参考:http://blog.csdn.net/dongliqiang2006/article/details/5 ...

随机推荐

  1. JEECMS页面中常用标签

    (1)在段落前给每一行加序号 从0开始:${a_index}从1开始:${a_index+1} (2)标记说明 [文章导航]:[@cms.Position /] [文章标题]:${arti.title ...

  2. LeetCode 65 Valid Number

    (在队友怂恿下写了LeetCode上的一个水题) 传送门 Validate if a given string is numeric. Some examples: "0" =&g ...

  3. C++ STL之stack

    因为总用vector,却忘记了有stack,今天用到栈顶的值才想起来,说起来stack很方便,也很容易用,看下边例子: #include<stack> #include<iostre ...

  4. zabbix表结构

    zabbix数据库表结构的重要性 想理解zabbix的前端代码.做深入的二次开发,甚至的调优,那就不能不了解数据库的表结构了. 我们这里采用的zabbix1.8.mysql,所以简单的说下我们mysq ...

  5. shell脚本等的操作

    1.命令替换:`` 反向单引号,也称重音符.键盘上和~键在一起的那个键呦,千万不要敲成单引号. A. 使用了``后,shell首先替换输出中``括起来的date命令,然后执行整个输出命令. B.命令替 ...

  6. Spring学习3—控制反转(IOC)基于Annotation(注解)的依赖注入实现

    一.依赖注入--手工装配—注解方式 在java代码中使用@Autowired或@Resource注解方式进行装配的前提条件是:   1.引入context命名空间 需要在xml配置文件中配置以下信息: ...

  7. PHP中GD2的运用,注意编码格式的改变,以及head()函数之前不能有任何html元素包括空格!!!

    <?php header ( "Content-type: text/html; charset=utf-8" ); //设置文件编码格式 header("Cont ...

  8. 关于talbeViewCell一点感想

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPa ...

  9. WebSocket 是什么原理?为什么可以实现持久连接?

    https://www.zhihu.com/question/20215561   作者:Ovear链接:https://www.zhihu.com/question/20215561/answer/ ...

  10. 清空file input框

    测试环境:OS --> winXPBrowsers --> IE6+, FF 3.0.11, FF 3.5, Opera 9.64, Opera 10 beta 2, Safari 4, ...