I'm trying to use the original som implementation by Kohonen but I'm getting a segmentation fault error using vcal.
It turns out that you can use an unofficial version which corrects this error found at http://cis.legacy.ics.tkk.fi/hynde/lvq/ but its from 1997, i'm sure that there are a lot of changes in cc compiler so I'm getting this error
checo@canija:~/bin/som/som_pak-3.2$ make gcc -O2 -c -o vcal.o vcal.c In file included from datafile.h:28, from vcal.c:26: fileio.h:69: error: conflicting types for ‘getline’ /usr/include/stdio.h:651: note: previous declaration of ‘getline’ was here make: *** [vcal.o] Error 1 checo@canija:~/bin/som/som_pak-3.2$
The file datafile.h
1:#ifndef SOMPAK_DATAFILE_H 2:#define SOMPAK_DATAFILE_H ... 24:#include 25:#include 26:#include "lvq_pak.h" 27:#include "errors.h" 28:#include "fileio.h"
Is there anything I can do to recomple this code?
Converting a comment to an answer to allow the question to be resolved.
getline()
is now a POSIX function; it wasn't in 1997. Your best bet may be to rename the function in fileio.h
and where it is used, maybe as simply as adding before the appearance of getline
and after the #include <stdio.h>
.
#undef getline
#define getline(a, b, c) som_getline(a, b, c)
Use the right number of parameters, or
#define getline(...) som_getline(__VA_ARGS__)
If <stdio.h>
is not yet included, then add it to ensure that getline()
is declared normally, then mapped by your macro.