刚开始编译时,出现./xlslib/format.h:148: error: expected unqualified-id before '&' token错误的处理方法:
记得在./configure后加入CPPFLAGS="-D _GLIBCXX_USE_WSTRING"选项,这样才能有wstring的声明,即运行./configure CPPFLAGS="-D _GLIBCXX_USE_WSTRING"
另外,如果在windows平台想要成功编译出动态链接库,还必须增加“-no-undefined”选项,即./configure CPPFLAGS="-D _GLIBCXX_USE_WSTRING -D -no-undefined"。至于原因,可见libtool帮助文档,摘录如下:
‘win32-dll’
This option should be used if the package has been ported to build
clean dlls on win32 platforms. Usually this means that any library data
items are exported with __declspec(dllexport) and imported with __
declspec(dllimport). If this macro is not used, libtool will assume that
the package libraries are not dll clean and will build only static libraries
on win32 hosts.
Provision must be made to pass ‘-no-undefined’ to libtool in link mode
from the package Makefile. Naturally, if you pass ‘-no-undefined’, you
must ensure that all the library symbols really are defined at link time!
‘-no-undefined’
Declare that output-file does not depend on any libraries other than the ones
listed on the command line, i.e., after linking, it will not have unresolved sym-
bols. Some platforms require all symbols in shared libraries to be resolved at
library creation (see Chapter 9 [Inter-library dependencies], page 46), and using
this parameter allows libtool to assume that this will not happen.