Reputation: 3412
I have a little program, when I run make
this error appears:
$ make
make all-recursive
make[1]: se ingresa al directorio «/home/foo/boolham»
Making all in src
make[2]: se ingresa al directorio «/home/foo/boolham/src»
/bin/bash ../libtool --tag=CC --mode=link gcc -std=gnu99 -g -O2 -o set set.o
libtool: link: gcc -std=gnu99 -g -O2 -o set set.o
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status
make[2]: *** [set] Error 1
make[2]: se sale del directorio «/home/foo/boolham/src»
make[1]: *** [all-recursive] Error 1
make[1]: se sale del directorio «/home/foo/boolham»
make: *** [all] Error 2
My Makefile.am
has:
lib_LTLIBRARIES = libfsequence.la
libfsequence_la_SOURCES = fsequence.c fsequence.h
bin_PROGRAMS = set main
main_SOURCES = main.c main.h
set_SOURCES = set.c set.h
main_LDADD = libfsequence.la
main.c
has only int main()
function, set.c
has sets functions and fsequences.c
has functions to generate sequences of numbers. fsequences.c
includes set.h
as a utility functions and main.c
includes fsequences.h
.
What's wrong with my code?
Upvotes: 0
Views: 924
Reputation: 4369
It is a little shot in the dark, but I guess your set.c file is a file without main. Then You should not treat it as a program - it should be compiled with -c option (so .o file will be generated and linked with main).
I'm not familiar with autotools, but you should check some examples how to do that.
EDIT:
according to: http://socgsa.cs.clemson.edu/seminar/tools06/resources/08_autotools/automake.htm you just should remove 'set' from 'bin_PROGRAMS'
Upvotes: 2