I wish to use the CImg li开发者_Go百科brary for image processing in my current project. I am using Codegear C++ Builder 2009. I include CImg.h
in the source file and put in the following code:
int rows =5;
int cols = 5;
CImg<double> img(rows,cols);
I get the following error:
[BCC32 Error] CImg.h(39159): E2285 Could not find a match for 'CImg<unsigned char>::move_to<t>(const CImg<unsigned char>)'
Does anyone know if there is a #define
I should be using when building in Codegear C++ Builder 2009. Or is it simply not compatible?
A 40,000 line library that's contained in a single header file? That seems like a bad idea...
Anyway, unfortunately, C++Builder 2009 isn't a very good C++ compiler, so it will often fail to handle otherwise legal C++ constructs. (It's not unusual for C++ compilers to fail to properly handle one aspect or another of the C++ standard, just because C++ is such a complicated language.)
When this happens, your main choices are to find another library, find another compiler, wait for a new and hopefully better version of C++Builder, or try and tweak the library to make it work.
In this case, if you decide to try and make the library work, the following changes should get you started:
- For the template version of `move_to` (line 9145 in CImg 1.3.4), C++Builder fails to detect t as a template parameter to the `move_to` parameter. Change the function declaration from its current type-safe version:
template<typename t> CImg<t>& move_to(CImg<t>& img) {
to the simplertemplate<typename t> t& move_to(t& image) {
-
Help C++Builder figure out the proper template parameters for the draw_text call on line 39163: replace
draw_text(...)
withdraw_text<unsigned char,unsigned char>(...)
.
There are more compiler errors than just these two; you'll have to similarly adjust the CImg source code for those.
If you're able to get everything working, then once you're done, you can see if the CImg project is interested in incorporating your changes to add C++Builder support to their official release.
精彩评论