0

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
zoo
  • 1,881
  • 1
  • 17
  • 24

1 Answers1

2

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

Community
  • 1
  • 1
selbie
  • 91,215
  • 14
  • 97
  • 163