c - Problem with automake and linking -


so, after spending couple of hours of manually configuring autotools, managed create makefile project. problem? gives me problems linker.

let me explain better: have project divided in several subprograms, of linked main program, main.c. problem while can compile gcc, make gives me dreaded collect2: ld returned 1 exit status error, naming undefined reference main reason. now, know it's linking error, , proof of compile files without linking them adding -c among cflags in makefile.am. knew that, guess.

my question is: should add makefile.am (the 1 inside src folder, guess?) file in order let link files 1 , not separately, linker find entry point in main.o? basically, equivalent of running "gcc program1.c program2.c main.c". know automake because builds files progressively, 1 @ time, , know it's dumb question it's driving me crazy anyway. it's first time use autotools, me make not last!

if foo program's name , you're not doing fancy,

bin_programs = foo foo_sources = program1.c program2.c main.c foo_ldadd = # other libraries go here -l arguments 

should sufficient makefile.am.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -