undefined reference to.....
Oct 18, 2013 at 8:58pm UTC
Dear all,
I'm newbie, i downloaded some open code to reference, but i can't compile them, i have read many topics about that but i can't understand, who can help me fix in this code.
i use Dev-c,gcc
erro: undefineded reference to `std::Machine::...'
here's the code: main
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
#include "Machine.h"
#include "FeaturesSelection.h"
#include <iostream>
#include <fstream>
#include <unistd.h>
using namespace std;
void usage()
{
cout << "./predictor -i input_file_path -o output_file_path" << endl;
return ;
}
int main(int argc, char **argv)
{
if (argc != 5) {
usage();
return 1;
}
extern char *optarg;
int opt;
string inputfile, outputfile;
while ((opt = getopt(argc, argv, "i:o:" )) != -1) {
switch (opt) {
case 'i' :
inputfile = optarg;
break ;
case 'o' :
outputfile = optarg;
break ;
default :
break ;
}
}
//Predictor
ifstream ifs1(inputfile.c_str());
if (!ifs1) {
cout << "Failed to open " << inputfile << endl;
usage();
return 1;
}
Machine predictor(3, "" , PREDICT);
if (!predictor.load()) {
cout << "Failed to load data from dongdu.model and dongdu.map" << endl;
return 1;
}
clock_t start = clock(), finish;
cout << "Start segmenting ..." << endl;
ofstream ofs(outputfile.c_str());
string buf;
size_t number_lines = 0;
while (getline(ifs1, buf)) {
ofs << predictor.segment(buf) << endl;
number_lines ++;
}
cout << "End segmenting." << endl;
finish = clock();
printf("Segment %d line(s). \n" , number_lines);
printf("Segmentation took %f seconds to execute\n" ,
((double ) (finish - start)) / CLOCKS_PER_SEC); //
ofs.close();
ifs1.close();
return 0;
}
it's so many file,i'm only up main file, you can download at
http://dl.dropbox.com/u/55960518/DongDu/src.zip
tks !!!
Topic archived. No new replies allowed.