松鼠的博客

导航

统计

BCB配置和使用GDI+

在BCB6中编译GDI+程序  
   
  1.)   在BCB6中已自带了ghiplus.h文件,故只需要生成gdiplus.lib文件就可以:  
          在命令行下运行implib   gdiplus.lib   gdiplus.dll。(如果ghiplus.dll不在当前文件夹下,注意写完整路径)  
   
  2.)   在工程的编译选项中加入STRICT条件编译:  
          Project-->Options-->Directories/Conditionals-->Condtionals-->点击旁边的"..."按钮-->输入STRICT,然后Add。
   
    
  3.)   在工程中加入Gdiplus.lib:  
          Project-->Add   To   Project-->找到Gdiplus.lib添加进来。  
   
  4.)   在工程的.h文件中包含所需的头文件,注意先后顺序:  
          #include   "math.hpp"  
          #include   <algorithm>  
          using   std::min;  
          using   std::max;  
          #include   "gdiplus.h"  
          using   namespace   Gdiplus;  
   
  5.)   为避免编译时产生的Warning,可以在.cpp文件头部加入:  
   
          #pragma   warn   -inl  
          #pragma   warn   -8022  
   
  6.)   在单元文件的.h中添加以下内容:  
          private: //   User   declarations  
            ULONG_PTR   GdiplusToken;  
            Gdiplus::GdiplusStartupInput   GdiplusStartupInput;  
          public: //   User   declarations  
            __fastcall   TMainForm(TComponent*   Owner);  
            __fastcall   ~TMainForm(void);  
   
  7.)   在单元文件的.cpp中添加:  
          //---------------------------------------------------------------------------  
          __fastcall   TMainForm::TMainForm(TComponent*   Owner)  
                  :   TForm(Owner)  
          {  
                  GdiplusStartup(&GdiplusToken,   &GdiplusStartupInput,   NULL);   //   初始化GDI+  
          }  
          //---------------------------------------------------------------------------  
          __fastcall   TMainForm::~TMainForm(void)  
          {  
                  GdiplusShutdown(GdiplusToken);   //   关闭GDI+  
          }   

  8.) 编译错误
[C++ Error] GdiplusGraphics.h(34): E2015 Ambiguity between 'Gdiplus::Graphics::Graphics(void *)' and 'Gdiplus::Graphics::Graphics(void *,int)'
[C++ Error] MainFormUnit.h(37): E2303 Type name expected
[C++ Error] MainFormUnit.cpp(53): E2045 Destructor name must match the class name
[C++ Error] MainFormUnit.cpp(54): E2171 Body has already been defined for function '_fastcall TForm1::~TForm1()'

在C++ Builder 2009里面的设置

posted on   Xproer-松鼠  阅读(1944)  评论(0编辑  收藏  举报

编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示