-1

我在链接中编译项目:http ://www.dis.uniroma1.it/challenge9/code/ch9-1.1.tar.gz 当我编译文件 /solver/mlb-dimacs 时出现错误。请帮我!

g++ -ansi -Wall -O6 -DNDEBUG -I../../lib -o sq.exe main.cc sp.cc smartq.cc parser_gr.cc timer.cc parser_ss.cc -lm        
main.cc: In function ‘int main(int, char**)’:
main.cc:103:18: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
main.cc:112:22: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc: In function ‘int parse_gr(long int*, long int*, Node**, Arc**, long int*, char*)’:
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
g++ -ansi -Wall -O6 -DNDEBUG -I../../lib -DMLB -DSINGLE_PAIR -o mbp.exe main.cc sp.cc smartq.cc parser_gr.cc timer.cc parser_p2p.cc -lm        
main.cc: In function ‘int main(int, char**)’:
main.cc:103:18: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
main.cc:105:18: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
main.cc:112:22: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc: In function ‘int parse_gr(long int*, long int*, Node**, Arc**, long int*, char*)’:
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
g++ -ansi -Wall -O6 -DNDEBUG -I../../lib -DCHECKSUM -o sqC.exe main.cc sp.cc smartq.cc parser_gr.cc timer.cc parser_ss.cc -lm        
main.cc: In function ‘int main(int, char**)’:
main.cc:103:18: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
main.cc:112:22: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc: In function ‘int parse_gr(long int*, long int*, Node**, Arc**, long int*, char*)’:
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
g++ -ansi -Wall -O6 -DNDEBUG -I../../lib -DMLB -DCHECKSUM -DSINGLE_PAIR -o mbpC.exe main.cc sp.cc smartq.cc parser_gr.cc timer.cc parser_p2p.cc -lm        
main.cc: In function ‘int main(int, char**)’:
main.cc:103:18: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
main.cc:105:18: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
main.cc:112:22: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc: In function ‘int parse_gr(long int*, long int*, Node**, Arc**, long int*, char*)’:
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
le@le-Extensa-4630:~/Desktop/ch9-1.1/solvers/mlb-dimacs$ make
g++ -ansi -Wall -O6 -DNDEBUG -I../../lib -o sq.exe main.cc sp.cc smartq.cc parser_gr.cc timer.cc parser_ss.cc -lm        
main.cc: In function ‘int main(int, char**)’:
main.cc:105:18: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
main.cc:114:22: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc: In function ‘int parse_gr(long int*, long int*, Node**, Arc**, long int*, char*)’:
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
g++ -ansi -Wall -O6 -DNDEBUG -I../../lib -DMLB -DSINGLE_PAIR -o mbp.exe main.cc sp.cc smartq.cc parser_gr.cc timer.cc parser_p2p.cc -lm        
main.cc: In function ‘int main(int, char**)’:
main.cc:105:18: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
main.cc:107:18: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
main.cc:114:22: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc: In function ‘int parse_gr(long int*, long int*, Node**, Arc**, long int*, char*)’:
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
g++ -ansi -Wall -O6 -DNDEBUG -I../../lib -DCHECKSUM -o sqC.exe main.cc sp.cc smartq.cc parser_gr.cc timer.cc parser_ss.cc -lm        
main.cc: In function ‘int main(int, char**)’:
main.cc:105:18: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
main.cc:114:22: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc: In function ‘int parse_gr(long int*, long int*, Node**, Arc**, long int*, char*)’:
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
g++ -ansi -Wall -O6 -DNDEBUG -I../../lib -DMLB -DCHECKSUM -DSINGLE_PAIR -o mbpC.exe main.cc sp.cc smartq.cc parser_gr.cc timer.cc parser_p2p.cc -lm        
main.cc: In function ‘int main(int, char**)’:
main.cc:105:18: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
main.cc:107:18: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
main.cc:114:22: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc: In function ‘int parse_gr(long int*, long int*, Node**, Arc**, long int*, char*)’:
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
parser_gr.cc:116:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
4

1 回答 1

5

在 C++ 中,字符串文字具有类型const char [](请注意,这与 C 不同,在 C 中,字符串文字char []由于历史原因而具有类型。)

所以你应该改变

static char *err_message[] = 
  { 
/* 0*/    "more than one problem line.",
/* 1*/    "wrong number of parameters in the problem line.",

static const char *err_message[] = 
  { 
/* 0*/    "more than one problem line.",
/* 1*/    "wrong number of parameters in the problem line.",

在 main.cc 中,SZ_DIK_SMARTQ是一个字符串文字,并且szAlgorithm是 type char *,你可以const_cast这样使用:

szAlgorithm = const_cast<char *>(SZ_DIK_SMARTQ);
于 2013-08-04T13:53:07.073 回答