Hi!
Would someone please help me thess C error(in gcc on Linux)?
The compiler continues to give me:
readLP.o: In function `Input_Problem' :
readLP.o(.text+ 0x0): multiple definition of `Input_Problem'
main.o(.text+0x 2f2): first defined here
/usr/bin/ld: Warning: size of symbol `Input_Problem' changed from 172
to 185 in
readLP.o
readLP.o: In function `Input_Problem' :
readLP.o(.text+ 0x28): undefined reference to `max_no_row'
readLP.o(.text+ 0x2e): undefined reference to `max_no_col'
readLP.o(.text+ 0x74): undefined reference to `read_problem'
collect2: ld returned 1 exit status.
What happens?
Thank you so much!
I have 4 files in my code, they are:
main1.c, main1.h, readLP.c, and readLP.h.
/*************** *************** *************** *************** *********/
In main.c file:
#include "main1.h"
int max_no_col, max_no_row;
int read_problem(ch ar *file); /* prototype */
extern int Input_Problem(v oid);
int main (int argc, char **argv)
{
max_no_col = MAX_NUMCOLS;
max_no_row = MAX_NUMROWS;
Input_Problem() ; /* call sub-routine */
...
}
int read_problem(ch ar *file) {
......
}
/*************** *************** *************** *************** *********/
/*************** *************** *************** *************** *********/
In readLP.c file:
#include "readLP.h"
int Input_Problem(v oid);
extern int read_problem(ch ar *file); /* prototype */
extern int max_no_col, max_no_row;
extern double (*A)[ ];
.....
int Input_Problem( )
{
};
/*************** *************** *************** *************** *********/
/*************** *************** *************** *************** *********/
In main.h file:
#define MAX_NUMROWS 181010
#define MAX_NUMCOLS 201
double (*A)[MAX_NUMCOLS];
.....
/*************** *************** *************** *************** *********/
Thanks again!
Would someone please help me thess C error(in gcc on Linux)?
The compiler continues to give me:
readLP.o: In function `Input_Problem' :
readLP.o(.text+ 0x0): multiple definition of `Input_Problem'
main.o(.text+0x 2f2): first defined here
/usr/bin/ld: Warning: size of symbol `Input_Problem' changed from 172
to 185 in
readLP.o
readLP.o: In function `Input_Problem' :
readLP.o(.text+ 0x28): undefined reference to `max_no_row'
readLP.o(.text+ 0x2e): undefined reference to `max_no_col'
readLP.o(.text+ 0x74): undefined reference to `read_problem'
collect2: ld returned 1 exit status.
What happens?
Thank you so much!
I have 4 files in my code, they are:
main1.c, main1.h, readLP.c, and readLP.h.
/*************** *************** *************** *************** *********/
In main.c file:
#include "main1.h"
int max_no_col, max_no_row;
int read_problem(ch ar *file); /* prototype */
extern int Input_Problem(v oid);
int main (int argc, char **argv)
{
max_no_col = MAX_NUMCOLS;
max_no_row = MAX_NUMROWS;
Input_Problem() ; /* call sub-routine */
...
}
int read_problem(ch ar *file) {
......
}
/*************** *************** *************** *************** *********/
/*************** *************** *************** *************** *********/
In readLP.c file:
#include "readLP.h"
int Input_Problem(v oid);
extern int read_problem(ch ar *file); /* prototype */
extern int max_no_col, max_no_row;
extern double (*A)[ ];
.....
int Input_Problem( )
{
};
/*************** *************** *************** *************** *********/
/*************** *************** *************** *************** *********/
In main.h file:
#define MAX_NUMROWS 181010
#define MAX_NUMCOLS 201
double (*A)[MAX_NUMCOLS];
.....
/*************** *************** *************** *************** *********/
Thanks again!
Comment