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. Java设计模式-备忘录模式(Memento)

    主要目的是保存一个对象的某个状态,以便在适当的时候恢复对象,个人觉得叫备份模式更形象些,通俗的讲下:假设有原始类A,A中有各种属性,A可以决定需要备份的属性,备忘录类B是用来存储A的一些内部状态,类C ...

  2. Java算法-希尔排序

    希尔排序的诞生是由于插入排序在处理大规模数组的时候会遇到需要移动太多元素的问题.希尔排序的思想是将一个大的数组“分而治之”,划分为若干个小的数组,以 gap 来划分,比如数组 [1, 2, 3, 4, ...

  3. 【Gym 100015B】Ball Painting

    题 There are 2N white balls on a table in two rows, making a nice 2-by-N rectangle. Jon has a big pai ...

  4. Hive简单优化;workflow调试

    1. 定义job名字 SET mapred.job.name='customer_rfm_analysis_L1'; 这样在job任务列表里可以第一眼找到自己的任务. 2. 少用distinct, 尽 ...

  5. BZOJ-4424 &&CodeForces-19E Fairy DP+dfs (Link-Cut-Tree可A)

    Va爷的胡策题T2 E. Fairy time limit per test1.5 seconds memory limit per test256 megabytes inputstandard i ...

  6. BZOJ2456 mode

    Description 给你一个n个数的数列,其中某个数出现了超过n div 2次即众数,请你找出那个数. Input 第1行一个正整数n. 第2行n个正整数用空格隔开. Output 一行一个正整数 ...

  7. rockmongo用法

    .简单查询 //xid=560870 and type=video { , "type": "video" } //查询数组中的数据 array( " ...

  8. 织梦DedeCms去掉栏目页面包屑导航最后的分隔符“>”

    织梦DedeCms的面包屑导航调用标签{dede:field name=’position’ /},在栏目页里调用的面包屑导航,最后会出现分割符号“>”,如:主页 > DedeCms 模板 ...

  9. The file couldn’t be opened because you don’t have permission to view it

    because you dont have permission to view it 解决办法 Project---Build Setting中 修改这一项,变成Default Compiler(A ...

  10. JS 内部传参