Why does this library work perfectly with Apple LLVM 5.0 (clang-500.2.79), while merely including the header file causes an error with GCC 4.9?
Minimal source file that produces the error:
#include <divsufsort.h>
int main() {
return 0;
}
The error I get with GCC 4.9:
In file included from main.cpp:1:0:
/usr/local/include/divsufsort.h:74:1: error: expected constructor, destructor, or type conversion before '(' token
DIVSUFSORT_API
^
/usr/local/include/divsufsort.h:86:1: error: expected constructor, destructor, or type conversion before '(' token
DIVSUFSORT_API
^
/usr/local/include/divsufsort.h:94:1: error: expected constructor, destructor, or type conversion before '(' token
DIVSUFSORT_API
^
/usr/local/include/divsufsort.h:108:1: error: expected constructor, destructor, or type conversion before '(' token
DIVSUFSORT_API
^
/usr/local/include/divsufsort.h:123:1: error: expected constructor, destructor, or type conversion before '(' token
DIVSUFSORT_API
^
/usr/local/include/divsufsort.h:137:1: error: expected constructor, destructor, or type conversion before '(' token
DIVSUFSORT_API
^
/usr/local/include/divsufsort.h:152:1: error: expected constructor, destructor, or type conversion before '(' token
DIVSUFSORT_API
^
/usr/local/include/divsufsort.h:169:1: error: expected constructor, destructor, or type conversion before '(' token
DIVSUFSORT_API
I suspect that you need to run ./configure
on the libdivsufsort directory again with the CC environment variable pre-set for the compiler you intend to use. (CC for "c" code. CXX for c++ code). Then rebuild.
cd ~/libdivsufsort-2.0.1
make clean
CC=gcc
CXX=g++
./configure
make
Try this link: Configuring for a compiler different than the default while running configure
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.