红联Linux门户
Linux帮助

C++编译遇到多重定义的问题,从源代码来看只定义了一次啊!谢谢

发布时间:2009-01-07 18:56:03来源:红联作者:dengxiaojun1983
编译一个短代码,Makefile是用工具生成的,编译时却产生如下错误:
cores.o(.text+0x0): In function `triangulate(myParams*, int, float**, float*, float*, float*, float*)':
: multiple definition of `triangulate(myParams*, int, float**, float*, float*, float*, float*)'
cores.o(.text+0x0): first defined here
cores.o(.text+0x480): In function `linearize_positions(int, int, float**, float*, float**, float*)':
: multiple definition of `linearize_positions(int, int, float**, float*, float**, float*)'
cores.o(.text+0x480): first defined here
cores.o(.text+0x660): In function `compute_dop(float**, float*, long, long)':
: multiple definition of `compute_dop(float**, float*, long, long)'
cores.o(.text+0x660): first defined here
cores.o(.text+0x7f0): In function `ls_trad(float**, float*, long, long, float*)':
: multiple definition of `ls_trad(float**, float*, long, long, float*)'
cores.o(.text+0x7f0): first defined here
cores.o(.text+0xaf0): In function `triang_err_msg(myParams*)':
: multiple definition of `triang_err_msg(myParams*)'
cores.o(.text+0xaf0): first defined here
cores.o(.text+0x610): In function `apply_weights(float**, float*, float*, long,
long)':
: multiple definition of `apply_weights(float**, float*, float*, long, long)'
cores.o(.text+0x610): first defined here
cores.o(.text+0x200): In function `hoptriangulate(myParams*, int, float**, float*, float*, float*, float*)':
: multiple definition of `hoptriangulate(myParams*, int, float**, float*, float*, float*, float*)'
cores.o(.text+0x200): first defined here
cores.o(.text+0x560): In function `hoplinearize_positions(int, int, float**, float*, float**, float*)':
: multiple definition of `hoplinearize_positions(int, int, float**, float*, float**, float*)'
cores.o(.text+0x560): first defined here
cores.o(.text+0xac0): In function `ls_qr(float**, float*, long, long)':
: multiple definition of `ls_qr(float**, float*, long, long)'
cores.o(.text+0xac0): first defined here
cores.o(.text+0xad0): In function `ls_svd(float**, float*, long, long)':
: multiple definition of `ls_svd(float**, float*, long, long)'
cores.o(.text+0xad0): first defined here
cores.o(.text+0xae0): In function `mmse(myParams*, myScenario*, int)':
: multiple definition of `mmse(myParams*, myScenario*, int)'
cores.o(.text+0xae0): first defined here
pos_tools.o(.text+0x0): In function `randnum(long)':
: multiple definition of `randnum(long)'
pos_tools.o(.text+0x0): first defined here
pos_tools.o(.text+0x40): In function `nrand(float)':
: multiple definition of `nrand(float)'
pos_tools.o(.text+0x40): first defined here
pos_tools.o(.text+0xd0): In function `matrix(long, long, long, long)':
: multiple definition of `matrix(long, long, long, long)'
pos_tools.o(.text+0xd0): first defined here
pos_tools.o(.text+0x270): In function `nrerror(char const*)':
: multiple definition of `nrerror(char const*)'
pos_tools.o(.text+0x270): first defined here
pos_tools.o(.text+0x1a0): In function `imatrix(long, long, long, long)':
: multiple definition of `imatrix(long, long, long, long)'
pos_tools.o(.text+0x1a0): first defined here
pos_tools.o(.text+0x2e0): In function `free_matrix(float**, long, long, long, long)':
: multiple definition of `free_matrix(float**, long, long, long, long)'
pos_tools.o(.text+0x2e0): first defined here
pos_tools.o(.text+0x330): In function `free_imatrix(int**, long, long, long, long)':
: multiple definition of `free_imatrix(int**, long, long, long, long)'
pos_tools.o(.text+0x330): first defined here
pos_tools.o(.text+0x380): In function `print_matrix(float**, long, long, long, long)':
: multiple definition of `print_matrix(float**, long, long, long, long)'
pos_tools.o(.text+0x380): first defined here
pos_tools.o(.text+0x410): In function `print_ivector(int*, long, long)':
: multiple definition of `print_ivector(int*, long, long)'
pos_tools.o(.text+0x410): first defined here
pos_tools.o(.text+0x470): In function `set_matrix(float**, long, long, long, long)':
: multiple definition of `set_matrix(float**, long, long, long, long)'
pos_tools.o(.text+0x470): first defined here
pos_tools.o(.text+0x4e0): In function `zero_matrix(float**, long, long, long, long)':
: multiple definition of `zero_matrix(float**, long, long, long, long)'
pos_tools.o(.text+0x4e0): first defined here
pos_tools.o(.text+0x540): In function `vector(long, long)':
: multiple definition of `vector(long, long)'
pos_tools.o(.text+0x540): first defined here
pos_tools.o(.text+0x5a0): In function `free_vector(float*, long, long)':
: multiple definition of `free_vector(float*, long, long)'
pos_tools.o(.text+0x5a0): first defined here
pos_tools.o(.text+0x5d0): In function `ivector(long, long)':
: multiple definition of `ivector(long, long)'
pos_tools.o(.text+0x5d0): first defined here
pos_tools.o(.text+0x630): In function `free_ivector(int*, long, long)':
: multiple definition of `free_ivector(int*, long, long)'
pos_tools.o(.text+0x630): first defined here
pos_tools.o(.text+0x660): In function `inv_matrix(float**, long, float**)':
: multiple definition of `inv_matrix(float**, long, float**)'
pos_tools.o(.text+0x660): first defined here
pos_tools.o(.text+0x8c0): In function `ludcmp(float**, int, int*, float*)':
: multiple definition of `ludcmp(float**, int, int*, float*)'
pos_tools.o(.text+0x8c0): first defined here
pos_tools.o(.text+0xb70): In function `lubksb(float**, int, int*, float*)':
: multiple definition of `lubksb(float**, int, int*, float*)'
pos_tools.o(.text+0xb70): first defined here
pos_tools.o(.text+0x7c0): In function `transpose_matrix(float**, long, long, float**)':
: multiple definition of `transpose_matrix(float**, long, long, float**)'
pos_tools.o(.text+0x7c0): first defined here
pos_tools.o(.text+0x800): In function `mult_matrix(float**, float**, long, long, long, float**)':
: multiple definition of `mult_matrix(float**, float**, long, long, long, float**)'
pos_tools.o(.text+0x800): first defined here
pos_tools.o(.text+0xc80): In function `qrdcmp(float**, float**, float**, long, long)':
: multiple definition of `qrdcmp(float**, float**, float**, long, long)'
pos_tools.o(.text+0xc80): first defined here
pos_tools.o(.text+0xde0): In function `solveQRb(float**, float**, float*, long,
long, float*)':
: multiple definition of `solveQRb(float**, float**, float*, long, long, float*)'
pos_tools.o(.text+0xde0): first defined here
pos_tools.o(.text+0xfb0): In function `find_array_int(int, int*, int, int)':
: multiple definition of `find_array_int(int, int*, int, int)'
pos_tools.o(.text+0xfb0): first defined here
collect2: ld returned 1 exit status
make: *** [refine] Error 1

主要是两个文件core.cc和pos_tools.cc,我搜索过源码,只定义过一次,没有出现多重定义的情况啊,不知道是怎么回事?
附上Makefile和程序源代码
Makefile是用一个模拟软件提供的工具自动生成的,在源码的localization下面的build文件中,利用sh build就自动生成了。
Makefile中用到的NEDC就是这个模拟软件中的另一个工具!
谢谢!

ps:positif-0.2.tar.gz是源码
positif_error.tar里面包含了上面的编译过程中的提示信息和源码中用工具自动生成的Makefile
文章评论

共有 2 条评论

  1. dengxiaojun1983 于 2009-01-07 22:29:02发表:

    已经解决!是Makefile的问题!

  2. HopeDiyf 于 2009-01-07 20:30:07发表:

    不懂