[英]Libiconv C++ Builder
I'm currently trying to integrate the ZBar library to an application built in C++ Builder (XE6). 我目前正在尝试将ZBar库集成到C ++ Builder(XE6)内置的应用程序中。 However, the ZBar library depends on iconv which is not originally available in Windows, so I managed to get a static library of iconv for windows : "libiconvStatic.lib".
但是,ZBar库依赖于Windows中最初不可用的iconv,因此我设法为Windows获取了一个静态的iconv库:“ libiconvStatic.lib”。
Then I tried to import it to my project this way (I'm not sure the first line is necessary though) : 然后,我尝试以这种方式将其导入到我的项目中(尽管我不确定第一行是否必要):
#define USING_STATIC_LIBICONV
#include <iconv.h>
#pragma comment (lib, "libiconvStatic.lib")
The functions from iconv which are called in the file are iconv_open() , iconv() and iconv_close() . iconv中在文件中调用的函数是iconv_open() , iconv()和iconv_close() 。
I get through the compilation but get an error from the linker : 我完成了编译,但是从链接器得到了一个错误:
[ilink64 Error] Fatal : Invalid object file '/72'
[ilink64错误]致命:无效的目标文件'/ 72'
I already tried with both 32bits and 64bits versions of the libiconvStatic.lib . 我已经尝试过libiconvStatic.lib的32位和64位版本。
Do you know why the .lib is not recognized and how to solve this problem? 您知道为什么无法识别.lib以及如何解决此问题吗? Or any other way to make use of iconv in Windows (and C++ Builder) ?
还是以其他方式在Windows(和C ++ Builder)中使用iconv?
Thank you. 谢谢。
As mentioned in comments: you should build the library with C++Builder directly, as the object file format is different between MSVC and C++Builder. 如注释中所述:您应该直接使用C ++ Builder构建该库,因为目标文件格式在MSVC和C ++ Builder之间是不同的。
Alternatively, you could build a dynamic version of the library with MSVC, and just do implib libiconv.lib libiconv.dll
to generate a C++Builder compatible library from the DLL. 或者,您可以使用MSVC构建该库的动态版本,只需执行
implib libiconv.lib libiconv.dll
即可从DLL生成与C ++ Builder兼容的库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.