C ++ compilation encounters multiple definitions. From the source code, it is only defined once! Thank you-general Linux technology-Linux programming and kernel information. For more information, see the following. Compile a short code. Makefile is generated by a tool, but the following error occurs during compilation:
Cores. o (. text + 0x0): In function 'triangulate (myParams *, int, float **, float *, float *)':
: Multiple definition of 'triangulate (myParams *, int, 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 *)':
: Multiple definition of 'hoptriangulate (myParams *, int, 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 'participation (myParams *, myScenario *, int )':
: Multiple definition of 'participation (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 )':
: Multiple definition of 'matrix (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 )':
: Multiple definition of 'imatrix (long, long )'
Pos_tools.o (. text + 0x1a0): first defined here
Pos_tools.o (. text + 0x2e0): In function 'free _ matrix (float **, long )':
: Multiple definition of 'free _ matrix (float **, long )'
Pos_tools.o (. text + 0x2e0): first defined here
Pos_tools.o (. text + 0x330): In function 'free _ imatrix (int **, long )':
: Multiple definition of 'free _ imatrix (int **, long )'
Pos_tools.o (. text + 0x330): first defined here
Pos_tools.o (. text + 0x380): In function 'print _ matrix (float **, long )':
: Multiple definition of 'print _ matrix (float **, 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 )':
: Multiple definition of 'set _ matrix (float **, long )'
Pos_tools.o (. text + 0x470): first defined here
Pos_tools.o (. text + 0x4e0): In function 'zero _ matrix (float **, long )':
: Multiple definition of 'zero _ matrix (float **, 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 'ult _ matrix (float **, float **, long, float **)':
: Multiple definition of 'ult _ matrix (float **, float **, long, float **)'
Pos_tools.o (. text + 0x800): first defined here
Pos_tools.o (. text + 0xc80): In function 'qrdcmp (float **, long, long )':
: Multiple definition of 'qrdcmp (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
The two files are core. cc and pos_tools.cc. I have searched the source code and defined it only once. There are no multiple definitions. I don't know what is going on?
Add Makefile and program source code
Makefile is automatically generated using a tool provided by simulation software. In the build file under localization of the source code, it is automatically generated using sh build.
NEDC used in Makefile is another tool in this simulation software!
Thank you!
Ps: positif-0.2.tar.gz is the source code
Positif_error.tar contains the prompts during the above compilation process and Makefile automatically generated by tools in the source code.