GDI+在Win32项目(非MFC)中编译出错处理

来源:互联网 发布:最近火的网络歌曲 编辑:程序博客网 时间:2024/05/17 23:31

     今天,看到段代码是关于贴图的,在win32SDK环境下的实现。于是我想利用GDI+把这段代码整合下,就创建了个win32项目想到生成的程序,然后再stdafx.h最后加上:

  1. #include <gdiplus.h>
  2. using namespace Gdiplus;
  3. #pragma comment(lib,"GdiPlus")

可是,编译的时候出了一大堆错误--

1>stdafx.cpp
1>f:/program files/microsoft visual studio 8/vc/platformsdk/include/GdiplusImaging.h(67) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>f:/program files/microsoft visual studio 8/vc/platformsdk/include/GdiplusImaging.h(67) : error C2440: 'initializing' : cannot convert from 'const char [37]' to 'int'
1>        There is no context in which this conversion is possible

 

。。。。。。

我赶紧查MSDN,发现给出的实例根本没谈编译错误之类的话题,无果!

后来仔细看了看错误信息,估计是头文件顺序错了,可又不知道具体在哪?Google了下,有两种解决办法,但都没说具体原因~哎,看来又是MS~

 

    错误的解决办法:

    1.在stdafx.h中去掉WIN32_LEAN_AND_MEAN的定义
    2.在stdafx.h中包含#include <comdef.h>

原创粉丝点击