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. shell expr的用法

    root@tcx4440-03:~# var=$var+1root@tcx4440-03:~# echo $var3+1 要想达到预期结果,用下列三种方法: (1)let "var+=1&q ...

  2. 【CodeForces 602A】C - 特别水的题3-Two Bases

    http://acm.hust.edu.cn/vjudge/contest/view.action?cid=102271#problem/C Description After seeing the ...

  3. 【BZOJ-2295】我爱你啊 暴力

    2295: [POJ Challenge]我爱你啊 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 202  Solved: 141[Submit][St ...

  4. BZOJ-1925 地精部落 烧脑DP+滚动数组

    1925: [Sdoi2010]地精部落 Time Limit: 10 Sec Memory Limit: 64 MB Submit: 1053 Solved: 633 [Submit][Status ...

  5. PS图层混合模式实例详解

          PS中的很多概念都和Core Graphics中的概念相通,比如蒙版.路径.裁剪.混合模式等等.如果你对Core Graphics中的混合模式不太理解,阅读本篇文章能让你对Core Gra ...

  6. Virtualbox虚拟机安装Ubuntu图文版

    这篇文章给大家介绍一下如何在Windows系统下的Virtual Box虚拟机软件中安装Ubuntu系统. 适用环境:Windows系统作为物理机,在此平台上搭建一个Virtual Box虚拟平台,在 ...

  7. VirtualBox安装debian的详细方法步骤

    下面是用VirtualBox安装Debian6的方法和步骤 l 新建一个文件夹,用于存放虚拟硬盘,如Debian l 打开VirtualBox,点击新建 l 输入虚拟机名称,Debian_6 l 给虚 ...

  8. std::shared_ptr

    在std::shared_ptr被引入之前,C++标准库中实现的用于管理资源的智能指针只有std::auto_ptr一个而已.std::auto_ptr的作用非常有限,因为它存在被管理资源的所有权转移 ...

  9. 面向对象分析设计-------02UML+UML各种图形及作用

    一.UML是什么?UML有什么用? 二.UML的历史 三.UML的上层结构(Superstructure) 四.UML建模工具 五.UML的图(重点) 1.用例图(use case diagram) ...

  10. R语言的前世今生(转)

    最近因病休养在家,另外也算是正式的离开Snack Studio.终于有了大把可以自由支配的时间.可以自主的安排.最近闲暇的时间总算是恶补了不少前段时间行业没有时间关注的新事物.看着行业里引领潮流的东西 ...