最近在做界面
老大说要显示PNG 的图片
但是win32的GDI只能导入bmp图片
在网上搜了一下下,可以用GDI+的样子
但是编译还是通不过
以下注意事项也注意过了
1、使用GDI+时声明一下
#include <gdiplus.h>
using namespace Gdiplus;
#pragma comment(lib, "gdiplus")
2、再下载最新的SDK,将在VC环境中添加最新SDK的Include&Lib
3、上面两条都不是我最想说的WIN32 DLL中使用GDI+需要注意的。如果仅这样在编译时是通不过。将stdafx.h中向导生成的WIN32_LEAN_AND_MEAN宏注释掉就可以了。
但是还是提示什么namespace那边有问题难道win32不认得namespace??那我该怎么做才能显示png的图片呢
高手救救命啊
小妹分不多,回答的好的话,愿意把分全给你哦
老大说要显示PNG 的图片
但是win32的GDI只能导入bmp图片
在网上搜了一下下,可以用GDI+的样子
但是编译还是通不过
以下注意事项也注意过了
1、使用GDI+时声明一下
#include <gdiplus.h>
using namespace Gdiplus;
#pragma comment(lib, "gdiplus")
2、再下载最新的SDK,将在VC环境中添加最新SDK的Include&Lib
3、上面两条都不是我最想说的WIN32 DLL中使用GDI+需要注意的。如果仅这样在编译时是通不过。将stdafx.h中向导生成的WIN32_LEAN_AND_MEAN宏注释掉就可以了。
但是还是提示什么namespace那边有问题难道win32不认得namespace??那我该怎么做才能显示png的图片呢
高手救救命啊
小妹分不多,回答的好的话,愿意把分全给你哦
解决方案 »
- 哪位给个ODBC连接数据库用并把数据库里的表完全的显示在MFC中的list control控件中,这个迷茫很久了。求指点
- 选择随便一款网页游戏,让他做个模拟登录并且能在游戏里说话的程序,用封包通讯实现,要脱离网页。
- 请问对于图像中选中的不规则区域处理时,如何让边缘抗锯齿?
- dlg.DoModal() != IDOK 与dlg.DoModal() == IDOK的区别
- 关于数据库的连接,急急!!!! ,为什么没人回应啊!!!!
- 请问在vc2005 form下怎样得到一控件的CWnd或者hWnd?
- string.find(...)是什么用法?
- 在VC中的运算符重载.
- 在单机上测试socket程序,对地址设定一定要是:127.0.0.1吗?
- 用位图导入是引起的问题
- vc运行错误
- C++如何实现枚举打开的窗口
如果正常说明,还是“你的工程”的问题。
c:\gdi+\includes\gdiplus.h(105) : error C2061: syntax error : identifier 'Gdiplus'
c:\gdi+\includes\gdiplus.h(105) : error C2059: syntax error : ';'
c:\gdi+\includes\gdiplus.h(106) : error C2449: found '{' at file scope (missing function header?)
c:\gdi+\includes\gdiplus.h(152) : error C2059: syntax error : '}'双击错误定位到了
namespace Gdiplus
{
namespace DllExports
{
#include "GdiplusMem.h"
}; #include "GdiplusBase.h" // The following headers are used internally as well
#include "GdiplusEnums.h"
#include "GdiplusTypes.h"
#include "GdiplusInit.h"
#include "GdiplusPixelFormats.h"
#include "GdiplusColor.h"
#include "GdiplusMetaHeader.h"
#include "GdiplusImaging.h"
的namespace前面是不是win32不支持NAMESPACE呢??
windraw.c
c:\program files\microsoft visual studio\vc98\include\gdiplus.h(105) : error C2061: syntax error : identifier 'Gdiplus'
c:\program files\microsoft visual studio\vc98\include\gdiplus.h(105) : error C2059: syntax error : ';'
c:\program files\microsoft visual studio\vc98\include\gdiplus.h(106) : error C2449: found '{' at file scope (missing function header?)
c:\program files\microsoft visual studio\vc98\include\gdiplus.h(152) : error C2059: syntax error : '}'
{
namespace DllExports
{
#include "GdiplusMem.h"
}; #include "GdiplusBase.h" // The following headers are used internally as well
#include "GdiplusEnums.h"
#include "GdiplusTypes.h"
#include "GdiplusInit.h"
#include "GdiplusPixelFormats.h"
#include "GdiplusColor.h"
#include "GdiplusMetaHeader.h"
#include "GdiplusImaging.h"
#include "GdiplusColorMatrix.h" // The rest of these are used only by the application #include "GdiplusGpStubs.h"
#include "GdiplusHeaders.h" namespace DllExports
{
#include "GdiplusFlat.h"
};
#include "GdiplusImageAttributes.h"
#include "GdiplusMatrix.h"
#include "GdiplusBrush.h"
#include "GdiplusPen.h"
#include "GdiplusStringFormat.h"
#include "GdiplusPath.h"
#include "GdiplusLineCaps.h"
#include "GdiplusMetafile.h"
#include "GdiplusGraphics.h"
#include "GdiplusCachedBitmap.h"
#include "GdiplusRegion.h"
#include "GdiplusFontCollection.h"
#include "GdiplusFontFamily.h"
#include "GdiplusFont.h"
#include "GdiplusBitmap.h"
#include "GdiplusImageCodec.h"}; // namespace Gdiplus
这句话左看右看都不像是有错的啊,而且还是SDK中的原话
程序是公司以前留下来的,我们就在基础上改的,应该也没错,毕竟用了这么久
不加gdiplus.h就没有任何错误的
但是新建一个小型的程序,用GDI+的话就没错,为什么呢,崩溃ing
它内部会自动调用 GDI+ 对象。
如果你要显示 gif 动画,则必须自己调用 GDI+http://blog.csdn.net/DavidHsing/archive/2009/03/24/4020197.aspx
//Startup Gdiplus
GdiplusStartupInput gpGdiPlusStartupInput;
GdiplusStartup(&m_gpGdiPlusToken, &gpGdiPlusStartupInput, NULL);
2.在stdafx.h中包含#include <comdef.h>
windraw.c
e:\导航组\audioapp_n9\src\auimain\stdafx.h(1) : warning C4005: 'UNICODE' : macro redefinition
unknown(0) : see previous definition of 'UNICODE'
c:\program files\microsoft visual studio\vc98\include\comdef.h(17) : fatal error C1189: #error : Native Compiler support only available in C++ compiler
Error executing cl.exe.我的头文件是这样申明的
#define UNICODE
#ifndef ULONG_PTR
#define ULONG_PTR unsigned long*
#endif#include <windows.h>
#include <comdef.h> #include "c:\gdi+\includes\gdiplus.h"
using namespace Gdiplus;
#pragma comment(lib, "c:\\gdi+\\lib\\gdiplus.lib")
各位大虾指点一下哪里不对??
CImage是C++的类吧,C中不能用吧,C也没有虾米继承机制
另一种方法是:选择"项目->属性"菜单命令,在弹出的对话框中选中左侧的"链接器->输入"选项,在右侧的"附加依赖项"框中键入gdiplus.lib, (2)、在应用程序项目的应用类中,添加一个成员变量,如下列代码:ULONG_PTR m_gdiplusToken;
其中,ULONG_PTR是一个DWORD数据类型,该成员变量用来保存GDI+被初始化后在应用程序中的GDI+标识,以便能在应用程序退出后,引用该标识来调用Gdiplus:: GdiplusShutdown来关闭GDI+。(3)、在应用类中添加ExitInstance的重载,并添加下列代码用来关闭GDI+:int CGDIPlusApp::ExitInstance(){ Gdiplus::GdiplusShutdown(m_gdiplusToken); return CWinApp::ExitInstance();}(4)、在应用类的InitInstance函数中添加GDI+的初始化代码:
BOOL CGDIPlusApp::InitInstance(){ CWinApp::InitInstance(); Gdiplus::GdiplusStartupInput gdiplusStartupInput; Gdiplus::GdiplusStartup(&m_gdiplusToken, &gdiplusStartupInput, NULL); ...}
你都有向导生成的 “stdafx.h” 了,还是 Win32 啊??
VS2008 是在“工具”->“选项”->“项目和解决方案”->“VC++ 目录”
不过偶用的是vc6.0不是.NET
也不是C++的工程,是C
NOT C+++++++++++
准确的说是win32 的c
是不是不能用GDI+??不支持??
使用以下两种方法:
1.在“stdafx.h”文件中添加以下内容:
#include <comdef.h> 或者
2#define WIN32_LEAN_AND_MEAN 注释掉,它排除了#include <comdef.h> 的com定义支持。
哪还有C和C++之分?那你写
int c;
c++;
看能不能通过
才能使用
win32认得namespace 你用的c++ 也支持命名空间
vc6.0 默认没有 gdi+ 的,只有下载一个来装。
你是在函数里面用它吗?
声明拉吗?
用using声明:void func(){using namespace alex;//using指令using chris::love;//uisng声明love();//chirs::love();alex::love();//
是这样的答案?