Dependencies problem GNU automake


 
Thread Tools Search this Thread
Top Forums Programming Dependencies problem GNU automake
# 1  
Old 01-27-2009
Dependencies problem GNU automake

I am using the GNU automake.

I have created the Configure.in and Makefile.am files but don't know how to link in my dependencies.

I have basically added another project (OpenCV) to my eclipse workspace and want to reference this in the build. I have set Eclipse up to include the Cpp files from the new project and this works fine but when I "make" my project it tells me that the files I have referenced from OpenCV are undefined.

The following is the error:

....../TestMain.cpp:14: undefined reference to `cvLoadImage'
....../TestMain.cpp:15: undefined reference to `cvNamedWindow'
....../TestMain.cpp:16: undefined reference to `cvShowImage'
....../TestMain.cpp:17: undefined reference to `cvWaitKey'
....../TestMain.cpp:18: undefined reference to `cvReleaseImage'
....../TestMain.cpp:19: undefined reference to `cvDestroyWindow'

The following is from the Configure.in file:

AC_INIT(TestMain.cpp)
AM_INIT_AUTOMAKE(TestMain, 1.0)
AM_CONFIG_HEADER(config.h:config.in)
AC_PROG_CC
AC_PROG_CXX
AC_OUTPUT(Makefile)

The following is from the Makefile.am file:

bin_PROGRAMS = TestMain
INCLUDES = $(DEPS_CFLAGS)
LDADD = $(DEPS_LIBS)
TestMain_SOURCES = TestMain.cpp

How do I reference the other projects files?

Any help would be appreciated

Thanks
Bret
# 2  
Old 01-28-2009
Quote:
Originally Posted by hembergb
I am using the GNU automake.
That would be your main problem.
Quote:
I have basically added another project (OpenCV) to my eclipse workspace
Eclipse would perhaps be your second. Makefiles really aren't all that hard to write at all. Why burden yourself with crappy autogenerated makefiles and a heavy Java IDE?
Quote:
I have set Eclipse up to include the Cpp files from the new project and this works fine
Is it actually building them, though?
# 3  
Old 01-28-2009
I just plain never used GNU automake because it was a pain. Now I know why Smilie
# 4  
Old 01-28-2009
Automake

Unfortunately, I have always had someone else to do the make files for my previous projects so I don't know how to create one for myself. That's why I thought the GNU tool would be ideal - it looks to me I just have to add a couple of parameters and the rest is done for me.
# 5  
Old 01-28-2009
Quote:
Originally Posted by hembergb
Unfortunately, I have always had someone else to do the make files for my previous projects so I don't know how to create one for myself. That's why I thought the GNU tool would be ideal - it looks to me I just have to add a couple of parameters and the rest is done for me.
That was my intention when I used to use kdevelop, but it turns out that automake was finicky, impenetrable, slow(most projects can be compiled in their entirety several times over in the time configure spends checking the same things it checked the last 9000 times it ran), gigantic(probably larger than your project by a factor of ten or more), too often broke down for no good reason, inflexible(uh-oh, I need to add a new library -- time to regenerate my project from scratch!)... automake's next version upgrade obliterated all my projects when their scripts broke compatibility, forcing me to either recreate everything from scratch or just buckle down and learn makefiles already.

Makefiles turned out to be easy. autoconf just makes them look hard because it's so enormous and takes so many steps and spews so much clutter to do so little.

All a makefile does, is describe what files to turn into what files. It already has built-in rules to do most of what else you need. Here's a short example makefile that can transform a.cpp through f.cpp into 'executable' just by running 'make'.

Code:
# This file must be named Makefile and placed in the same dir as a.cpp through f.cpp

# The list of object files.  We don't need to tell it a.cpp, since
# make knows .o can be made from .c or .cpp and will search for it.
OBJS=a.o b.o c.o d.o e.o f.o

# Compiler flags go here.
CFLAGS=
# C++ specific compiler flags go here.  CFLAGS gets copied in.
CXXFLAGS=$(CFLAGS)
# Linker flags go here.  For example, let's link in the math library.
LDFLAGS=-lm

# Here we tell make that it needs a.o through f.o to build 'executable'.
# If it doesn't find them, it will build them.
# Note that there is a TAB in front of g++, not eight spaces.
executable:$(OBJS)
        g++ $(OBJS) $(LDFLAGS) -o executable
# Running 'make clean' will cause it to delete the objects and executable.
clean:
        rm -f $(OBJS) executable

# 6  
Old 02-03-2009
Thanks

Thanks for the info it helped heaps and has got me going.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. OS X (Apple)

GNU Sed Problem

Hi, I'm and Android developer using Mac OSX 10.7. I use Dsixda's Android Kitchen to develop my roms. I had it working fine on 10.6.8 and it still worked flawlessly when updating to 10.7. I installed Macports, and installed some packages, and then tried to run the Android Kitchen. I CD'd to the... (3 Replies)
Discussion started by: dmeadows013
3 Replies

2. Shell Programming and Scripting

using automake and autoconf with C++

hi, I have written the Makefile.am and autoconf.ac files and am looking to build my project by providing the following commands: $autoreconf -f -i -m $./configure both of the above work fine, but when I give the make command, I get the following error: make all-am make: Entering directory... (0 Replies)
Discussion started by: bacpp
0 Replies

3. Shell Programming and Scripting

automake does not create Makefile.in

hi all, I have written a simple C program hello.c and a Makefile.ac but when i try to run automake it does not create Makefile.in hence I am not able to run ./configure command in my directory. Following are the containts of my prog. hello.c -------- Code: #include<stdio.h> main() {... (0 Replies)
Discussion started by: useless79
0 Replies

4. UNIX for Advanced & Expert Users

KDE Needs Automake >= 1.6.1 -- I have 1.11

Hi, I'm on Fedora-11-x86_64 with KDevelop 3.5.4. I have automake 1.11 installed, but when I attempt to run automake and friends on a new project I get: *** YOU'RE USING automake (GNU automake) 1.11 *** KDE requires automake 1.6.1 or newer I reported(KDevelop) the error Bug: 210084 ... (11 Replies)
Discussion started by: lucelio
11 Replies

5. Red Hat

problem with Dependencies package !

Dear Friends , I am using RHEL 5 server . In Linux when I am going to install 'mod_ssl' rpm then I got the following error : # rpm -ivh mod_ssl-2.2.3-6.el5.i386.rpm --aid --force warning: mod_ssl-2.2.3-6.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 error: Failed... (5 Replies)
Discussion started by: shipon_97
5 Replies

6. Linux

Help needed in dependencies problem in Fedora 8 VM

hi, I have installed a VM for Fedora 8 running on Windows Xp. And I have the following error:- Error: Missing Dependency: libgsl.so.0 is needed by package test Error: Missing Dependency: /usr/bin/gcc is needed by package test Error: Missing Dependency: libgslcblas.so.0 is needed by... (3 Replies)
Discussion started by: ahjiefreak
3 Replies

7. Programming

GNU GDB compile problem

I have to compile gnu-gdb 6.7 on HP-UX 11.11 with /usr/local/pa64/bin/gcc 64-bit compiler, but I'm having some problems during "make": ser-tcp.c: In function `net_open': ser-tcp.c:207: warning: passing arg 5 of `getsockopt' from incompatible pointer type make: *** Error 1 make: Leaving... (8 Replies)
Discussion started by: untamed
8 Replies

8. Programming

automake/autoconf problem

hi, i'm fairly new with automake and i ran into a problem that i have found no solution for. so i have a setup where i don't want all the output files generated by the compiler and alike in my src directory, instead i created a build/unix folder and i have build/unix/config set for... (0 Replies)
Discussion started by: Akimaki
0 Replies

9. UNIX for Advanced & Expert Users

automake

hi on machine automake 1.9 are install but i am not able create make file so please tell me what proper command to create make file using automake (1 Reply)
Discussion started by: munnu
1 Replies
Login or Register to Ask a Question