zoukankan      html  css  js  c++  java
  • VC++遇到的错误汇集

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

    在Win32Project下使用,出现“error C1189: #error :  WINDOWS.H already included.  MFC apps must not #include <windows.h> d:program filesmicrosoft visual studio 10.0vcatlmfcincludeafxv_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 ,可以查找工程是否有定义重复的。

  • 相关阅读:
    在ant编译java文件时产生debug信息
    Ant里面神奇的fork
    在ant中将依赖jar包一并打包的方法
    Java通过class文件得到所在jar包
    Bat脚本:通过端口号查找进程号
    使用emma时遇到的一些问题
    python之路-day18-反射
    python之路-day17-类与类之间的关系
    python之路-day16-类的成员
    python之路-day15-初识面向对象
  • 原文地址:https://www.cnblogs.com/ike_li/p/3557093.html
Copyright © 2011-2022 走看看