能不能给我说下如何在mfc中使用agg呢?
我把agg编译成静态链接库,做个Win32程序运行Damo是没有问题的
可是如何把agg放到mfc中呢?
我把.h文件和lib文件放入mfc项目文件夹中,再link了lib文件,在OnDraw中画了条线。
代码没有问题,是使用hdc_randerer对图形进行转换。报错如下: hdc_renderer.obj : error LNK2005: "public: void __thiscall hdc_renderer::color(struct agg::rgba8)" (?color@hdc_renderer@@QAEXUrgba8@agg@@@Z) already defined in mfcView.obj
hdc_renderer.obj : error LNK2005: "private: void __thiscall hdc_renderer::draw_solid_span(int,int,int)const " (?draw_solid_span@hdc_renderer@@ABEXHHH@Z) already defined in mfcView.obj
hdc_renderer.obj : error LNK2005: "private: void __thiscall hdc_renderer::blend_pixel(int,int,unsigned int)const " (?blend_pixel@hdc_renderer@@ABEXHHI@Z) already defined in mfcView.obj
LINK : warning LNK4098: defaultlib "LIBCD" conflicts with use of other libs; use /NODEFAULTLIB:library
agg.lib(agg_platform_support.obj) : error LNK2001: unresolved external symbol "int __cdecl agg_main(int,char * * const)" (?agg_main@@YAHHQAPAD@Z)
Debug/mfc.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe. mfc.exe - 5 error(s), 1 warning(s) 我想可能是哪里配置出了问题了。
很困惑
我把agg编译成静态链接库,做个Win32程序运行Damo是没有问题的
可是如何把agg放到mfc中呢?
我把.h文件和lib文件放入mfc项目文件夹中,再link了lib文件,在OnDraw中画了条线。
代码没有问题,是使用hdc_randerer对图形进行转换。报错如下: hdc_renderer.obj : error LNK2005: "public: void __thiscall hdc_renderer::color(struct agg::rgba8)" (?color@hdc_renderer@@QAEXUrgba8@agg@@@Z) already defined in mfcView.obj
hdc_renderer.obj : error LNK2005: "private: void __thiscall hdc_renderer::draw_solid_span(int,int,int)const " (?draw_solid_span@hdc_renderer@@ABEXHHH@Z) already defined in mfcView.obj
hdc_renderer.obj : error LNK2005: "private: void __thiscall hdc_renderer::blend_pixel(int,int,unsigned int)const " (?blend_pixel@hdc_renderer@@ABEXHHI@Z) already defined in mfcView.obj
LINK : warning LNK4098: defaultlib "LIBCD" conflicts with use of other libs; use /NODEFAULTLIB:library
agg.lib(agg_platform_support.obj) : error LNK2001: unresolved external symbol "int __cdecl agg_main(int,char * * const)" (?agg_main@@YAHHQAPAD@Z)
Debug/mfc.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe. mfc.exe - 5 error(s), 1 warning(s) 我想可能是哪里配置出了问题了。
很困惑
解决方案 »
- MFC控件问题
- MFC编译的程序启动很慢
- 一个简单调用LIB问题
- 用ADO打开Excel文件,同时into一个Mdb文件成功,但报错,说程序非正常终止,帮我看看。
- 分别在Debug和release模式编译的程序区别这么大
- 高手们帮忙看看,一个很难解决的属性页问题,在线等
- 有谁用过DBGridEh里面的SaveGridLayoutIni和RestoreGridLayoutIni?
- 用什么方法可以取得当前窗口的句柄?
- 怎么通过参数传递的方式向一个工作者线程的处理函数传递一个字符串?非得用全局变量吗?
- 救苦救难的观世音菩萨!!!———怎样建DLL
- 如何将ACCESS自动编号字段改成多位
- 关于BMP存储过大问题
C:\WORK\SVG\LIB\3\mfc\platform\agg_platform_support.h(399): // int agg_main(int argc, char* argv[])
C:\WORK\SVG\LIB\3\mfc\platform\agg_platform_support.h(411): // The reason to have agg_main() instead of just main() is that SDL
2 occurrence(s) have been found.很显然,还是连接问题agg.lib(agg_platform_support.obj) : error LNK2001: unresolved external symbol "int __cdecl agg_main(int,char * * const)" (?agg_main@@YAHHQAPAD@Z)
Compiling...
StdAfx.cpp
Compiling...
MyMfc.cpp
MainFrm.cpp
MyMfcDoc.cpp
MyMfcView.cpp
Generating Code...
Linking...
LINK : warning LNK4098: defaultlib "LIBCD" conflicts with use of other libs; use /NODEFAULTLIB:library
agg.lib(agg_platform_support.obj) : error LNK2001: unresolved external symbol "int __cdecl agg_main(int,char * * const)" (?agg_main@@YAHHQAPAD@Z)
Debug/MyMfc.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.MyMfc.exe - 2 error(s), 1 warning(s)
http://picasso-graphic.googlecode.com/files/picasso_0.9_beta1.zip
http://code.google.com/p/picasso-graphic/
一旦包含这个文件,就要求用户实现 agg_main() 函数,但你没有实现。这个文件是开发AGG的DEMO用的,是AGG Demo的入口函数。
你可以不包含这个CPP。
实际上你要用AGG的话不需要把 platform,ctrl,util里面的文件加到工程里。这些都是特定平台的控件,用于快速开发DEMO用。