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. Maven-在eclipse创建maven项目

    在eclipse使用maven则需要给eclipse安装maven插件,具体安装maven插件安装相关文章 构建Maven项目 以eclipse3.6为例 1)创建简单Maven项目 点击Eclips ...

  2. mysql-分页查询方案

    一.直接使用limit最简单查询方法: , 在中小数据量的情况下,这样的SQL足够用了,唯一需要注意的问题就是确保使用了索引. 随着数据量的增加,页数会越来越多,查看后几页的SQL就可能类似: , 言 ...

  3. jdownload的使用

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...

  4. Unix/Linux 命令技巧

    锁定一个文件夹 为了我的数据隐私,我想要锁定我文件服务器下的/downloads文件夹.因此我运行了: chmod 0000 /downloads root用户仍旧可以访问,而ls和cd命令则不工作. ...

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

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

  6. python包的概念

    1 python程序由包(package).模块(module)和函数组成.包是由一系列模块组成的集合.模块是处理某一类问题的函数和类的集合. 2 包就是一个完成特定任务的工具箱. 3 包必须含有一个 ...

  7. php中静态变量和静态方法

    1,静态变量:所有对象共享的变量成为静态变量.静态变量类似于全局变量,不过全局变量破坏对象的封装性,因此其对应于面向过程:静态变量对应于面向对象. 2,全局变量,全局变量的使用实例如下,声明全局变量时 ...

  8. 《驾驭Core Data》 第一章 Core Data概述

    <驾驭Core Data>系列教程综合了<Core Data for iOS>,<Learning Core Data for iOS>,<Core Data ...

  9. 彻底理解position与anchorPoint

    引言 相信初接触到CALayer的人都会遇到以下几个问题: 为什么修改anchorPoint会移动layer的位置?CALayer的position点是哪一点呢?anchorPoint与positio ...

  10. struts+spring action应配置为scope="prototype"

    truts+spring action应配置为scope="prototype" <bean id="personAction" scope=" ...