NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
alexverde
Joined: 06 Apr 2012 Posts: 2
|
Posted: Fri Apr 06, 2012 3:14 pm Post subject: Unable to solve “undefined reference” error message |
|
|
Hi, hope someone can help me to get this fix.
I created a new netbeans project with existing sources and makefile. The project contains 3 files: two *.c files (main.c and test.c) and a header (test.h). The header contains the declaration of many functions including some external ones (Fortran LAPACK, BLAS libraries) not included in the corresponding test.c. However, the makefile include the path of directories containing these external functions (please, see details below):
---------------------------------------------------
CC = gcc
LD = gcc
LDPATH = -L/usr/lib
LDFLAGS = -llapack -lblas -lm
FLAGS = -Wall -O3
KERN = -DELASTIC #
PFLAG =
PROG = test
OBJS = main.o test.o
all: $(PROG)
main.o: main.c test.h
$(CC) $(FLAGS) $(KERN) -c main.c $(PFLAG)
%.o: %.c %.h
$(CC) $(FLAGS) $(KERN) -c $< $(PFLAG)
$(PROG): $(OBJS)
$(LD) $(OBJS) -o $(PROG) $(LDPATH) $(LDFLAGS) $(PFLAG)
---------------------------------------------------
I added a new file (dgmres.f) to the project with a new external function not included in the path declared above (makefile). I declared this new one in the header (test.h) but when I try to build the project, I got the following error message:
undefined reference to `dgmres_'
Assuming that the issue is closely related to the makefile specification, my questions is:
What changes Do I have to do in the makefile in order to include this new file/function?.
Please, let me know any comments or suggestions. I really appreciated any help on this regard.
PD: I am using Netbeans IDE 7.1.1 under linux Ubuntu 11.10. |
|
| Back to top |
|
 |
Paulo R. Panhoto Posted via mailing list.
|
Posted: Sat Apr 07, 2012 3:04 pm Post subject: Unable to solve |
|
|
After a quick peek, it seems to me that your makefile "doesn't know how
to compile your .f file". There should a portion like this in the makefile:
dgmres.o: dgmres.f
gfortran -c dgmres.f
Regards,
Paulo
On 06/04/12 12:14, alexverde wrote:
| Quote: | Hi, hope someone can help me to get this fix.
I created a new netbeans project with existing sources and makefile. The project contains 3 files: two *.c files (main.c and test.c) and a header (test.h). The header contains the declaration of many functions including some external ones (Fortran LAPACK, BLAS libraries) not included in the corresponding test.c. However, the makefile include the path of directories containing these external functions (please, see details below):
---------------------------------------------------
CC = gcc
LD = gcc
LDPATH = -L/usr/lib
LDFLAGS = -llapack -lblas -lm
FLAGS = -Wall -O3
KERN = -DELASTIC #
PFLAG =
PROG = test
OBJS = main.o test.o
all: $(PROG)
main.o: main.c test.h
$(CC) $(FLAGS) $(KERN) -c main.c $(PFLAG)
%.o: %.c %.h
$(CC) $(FLAGS) $(KERN) -c $< $(PFLAG)
$(PROG): $(OBJS)
$(LD) $(OBJS) -o $(PROG) $(LDPATH) $(LDFLAGS) $(PFLAG)
---------------------------------------------------
I added a new file (dgmres.f) to the project with a new external function not included in the path declared above (makefile). I declared this new one in the header (test.h) but when I try to build the project, I got the following error message:
undefined reference to `dgmres_'
Assuming that the issue is closely related to the makefile specification, my questions is:
What changes Do I have to do in the makefile in order to include this new file/function?.
Please, let me know any comments or suggestions. I really appreciated any help on this regard.
PD: I am using Netbeans IDE 7.1.1 under linux Ubuntu 11.10.
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|