0

I'm having an issue compiling code - specifically METIS - Serial Graph Partitioning and Fill-reducing Matrix Ordering.

I've successfully managed to make Visual Studio 2013 Project out of the source files two ways: using CMake GUI (version 3.4.3) and using Command Line.

However, in both cases when I try to build the created project in Visual Studio, I'm getting an error: Error C2059: syntax error : '(' on line

_CRTIMP double __cdecl rint(_In_ double _X);

where _CRTIMP is defined this way:

#define _CRTIMP __declspec(dllimport)

Is this issue caused in the process of creating Visual Studio Project by CMake, or is it a issue in source files of METIS?

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
T.Brown
  • 89
  • 9
  • Hm, what about searching through the metis source code? – Marcus Müller Feb 22 '16 at 19:29
  • I tried to search through the source code, but I didn't manage to locate the possible mistake. I don't understand, why there could be a problem with '(' on mentioned line. macro `_CRTIMP` is used a lot of times in the whole file and `rint()` is default function defined as `#define rint(x) ((int)((x)+0.5))` – T.Brown Feb 22 '16 at 19:41
  • 1
    I don't know, and this is really stabbing in the dark, but please be aware of VS, especially in older versions, not being C99-compatible at all. – Marcus Müller Feb 22 '16 at 19:43
  • @T.Brown Well, if `rint(x)` is really a macro, then of course it does not compile... the given line is expanded by the preprocessor to: `__declspec(dllimport) double __cdecl ((int)((_In_ double _X)+0.5));` – Gábor Buella Mar 06 '16 at 13:36
  • Also, as Marcus mentioned, VisualC++ is a C++ compiler. You would probably need a C compiler to compile C . I also tried compiling standard C, or GNU C before with Visual C++ , and gave up after a lot of frustration. Good luck to you. – Gábor Buella Mar 06 '16 at 13:39

2 Answers2

4

go to : metis\GKlib\gk_arch.h and metisbin.h and metislib.h. Remove or rename #define rint(x) ((idx_t)((x)+0.5)) it's causing a conflict with the rint function in math.h.

user1828433
  • 252
  • 2
  • 11
1

only comment out the line #define rint(x) ((idx_t)((x)+0.5)) in metis\GKlib\gk_arch.h is enough.

anonym11
  • 46
  • 3