LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-14-2006, 05:40 AM   #1
pietrom
LQ Newbie
 
Registered: Dec 2004
Location: Earth
Distribution: SuSE
Posts: 5

Rep: Reputation: 0
Automake: problems with a project with source files distributed in a directory tree


This is the first time I try to make a project with the Autotools... and I have a problem.
Everything is all right when the source files are all in the same directory.
But if I want to distribute the files in different subdirectories, I have some errors from make.

This is what I do:

aclocal
autoconf
automake --add-missing
./configure
make
entrypoint.o: In function `main':
testprj/entrypoint.cpp:14: undefined reference to `C1::Print()'

I.e. it cannot find the class declaration in the file placed in a subdirectory.

The includes are correct.
The subdirectories are passed to configure.
I put a Makefile.am in every subdirectory.
What else is missing?

I'm afraid I cannot attach any file to this message.

Can anybody give me a hint?
Do you know where I can find documentation that explains how to make a project with source files distributed in a directory tree?

If you want I can send you the (very small) test project where I have this problem.

Thank you a lot for any help,

Pietro
pietromele@yahoo.com



2006.04.14
 
Old 04-14-2006, 05:56 AM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Say, your source directory looks like this:
Code:
sourcedir/
  incl/
    Makefile.am
    yourheader.h
  src/
    Makefile.am
    main.c
  Makefile.am
And "main.c" file includes "yourheader.h" this way:
Code:
#include "yourheader.h"
To ensure the compiler (more precisely: the preprocessor) can find "yourheader.h" you should do this in "sourcedir/src/Makefile.am":
Code:
AM_CFLAGS = -Wall -I${top_srcdir}/incl
Hope this helps.
If not, please mail me your small test project and I'll have a look at it.

Last edited by Hko; 04-14-2006 at 06:00 AM.
 
Old 04-14-2006, 06:04 AM   #3
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
BTW someone posted this useful link recently on this forum:
http://sourceware.org/autobook/download.html

(free book on the autotools)
 
Old 04-14-2006, 06:48 AM   #4
pietrom
LQ Newbie
 
Registered: Dec 2004
Location: Earth
Distribution: SuSE
Posts: 5

Original Poster
Rep: Reputation: 0
Isn't #include "../incl/myheader.h" enough?

I'll try your suggestion this evening.
Actually I indicated the path explicitely in the include files:
Code:
    #include "../incl/myheader.h"
Isn't it enough?

Will the linker be able to find the object files in the different subdirectories?

Thank you,
Pietro

Last edited by pietrom; 04-14-2006 at 07:20 AM.
 
Old 04-14-2006, 08:04 AM   #5
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Quote:
Originally Posted by pietrom
I'll try your suggestion this evening.
Actually I indicated the path explicitely in the include files:
Code:
    #include "../incl/myheader.h"
Isn't it enough?
Yes, that should work also. I'm afraid I didn't understand your question correctly...
Sorry.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to copy files from an entire directory tree using terminal commands??? lusius188 Linux - General 3 04-10-2006 11:23 AM
Best distributed computing project? jdblick Linux - Software 1 05-02-2005 11:21 AM
locate and copy files - without directory tree rodda Linux - General 1 01-16-2005 02:10 AM
where is linux source build directory/kernel source tree? webazoid Linux - Software 2 07-01-2004 08:37 PM
How to copy a directory tree without copying the files in it? system Linux - General 2 01-15-2002 09:36 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration