In function `main':
FLRMA.cpp:(.text+0x1ed8): multiple definition of `main'
/home/mimi/CLAPACK/F2CLIBS/libf2c.a(main.o):(.text+0x0): first defined here
/home/mimi/CLAPACK/F2CLIBS/libf2c.a(main.o): In function `main':
(.text+0xb5): undefined reference to `MAIN__'
collect2: ld returned 1 exit status
I references the main.o in the f2c library. Am I missing something about the way I should set up my linking? I have several module files I link together. Attached below is my main file that calls a function from one of the other files and also the make file I am using. Please let me know if I am doing something wrong.
Thanks,
Mechie
- Code: Select all
OBJS = tensor.o submatrix_tensor.o tensor.h
CC = g++
DEBUG = -g
CFLAGS = -Wall -c $(DEBUG)
LFLAGS = -Wall $(DEBUG)
#g++ -o main.exe main.cpp -L. -llapack -lblas -lF77 -lI77
ROOTPATH = /home/mimi/CLAPACK
INCDIRS = -I$(ROOTPATH)/SRC -I$(ROOTPATH)
F2CDIR = $(ROOTPATH)/F2CLIBS
LDLIBS =-L $(ROOTPATH)/lapack_LINUX.a \
$(ROOTPATH)/blas_LINUX.a \
$(F2CDIR)/libf2c.a -lm
FLRMA.o: FLRMA.cpp submatrix_tensor.cpp tensor.cpp tensor.h
$(CC) $(LFLAGS) FLRMA.cpp $(LDLIBS) -o FLRTA.o
tensor.o: tensor.cpp tensor.h
$(CC) $(CFLAGS) tensor.cpp $(INCDIRS) -o tensor.o
submatrix_tensor.o: submatrix_tensor.cpp tensor.cpp tensor.h
$(CC) $(LFLAGS) submatrix_tensor.cpp $(LDLIBS) -o submatrix_tensor.o
this is the main file
- Code: Select all
using namespace std;
#include "tensor.h"
#include "submatrix_tensor.cpp"
#include "tensor.cpp"
/**********************MAIN FUNCTION*********************/
int main(void){
//reads data in A and initializes it
cout<<"I go into main before fault" <<endl;
A = initmatrix( filename, M, N);
cout<<"Atleast my matrix was initialized"<<endl;
display( A, M, N);
return 0;
}
I link with
- Code: Select all
g++ -L /home/mimi/CLAPACK/lapack_LINUX.a /home/mimi/CLAPACK/blas_LINUX.a /home/mimi/CLAPACK/F2CLIBS/libf2c.a -lm -o FLRMA FLRMA.cpp

