【发布时间】:2018-01-30 05:14:07
【问题描述】:
我正在尝试使用 C 语言在 Eclipse IDE 上使用 LIBSVM 包。
在 README 文件中,它声明“您需要在 C/C++ 源文件中#include "svm.h" 并且 用 `svm.cpp' 链接你的程序。"
我已在所有源文件中包含“svm.h”,并在源代码文件夹下添加了“svm.cpp”文件。但是,我在“svm.cpp”文件中收到错误“带有 C 链接的模板”。
错误是否与我在程序中添加“svm.cpp”文件的方式有关?我真的不明白,我试着到处搜索。
svm.cpp:
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <float.h>
#include <string.h>
#include <stdarg.h>
#include <limits.h>
#include <locale.h>
#include "libsvm.h"
#include "main.h"
#ifdef __cplusplus
extern "C" {
#endif
int libsvm_version = LIBSVM_VERSION;
typedef float Qfloat;
typedef signed char schar;
#ifndef min
template <class T> static inline T min(T x,T y) { return (x<y)?x:y; }
#endif
#ifndef max
template <class T> static inline T max(T x,T y) { return (x>y)?x:y; }
#endif
template <class T> static inline void swap(T& x, T& y) { T t=x; x=y; y=t; }
template <class S, class T> static inline void clone(T*& dst, S* src, int n)
.
.
.
.
.
.
.
.
#ifdef __cplusplus
}
#endif
【问题讨论】:
标签: c machine-learning linker linker-errors libsvm