[ODE] Compiling on unix

Adam D. Moss aspirin at ntlworld.com
Fri Jul 18 11:05:02 2003


This is a multi-part message in MIME format.
--------------070308080907030305030109
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hi.

druhan wrote:
> I get the following response:
> test_ode.cpp:24: ode.h: No such file or directory
> So is it simply a problem of not having the paths set properly?

Yeah.

 > I have my
> .bash_profile set to
> 
> PATH=$PATH:/users/grad/druhan/ode/lib:/users/grad/druhan/ode/include/ode:
> and the /users/grad/druhan/ode is where all the ODE stuff is. Am I missing 
> something terribly simple?

Yes, PATH is where to look for executables, and has nothing to do
with where to find language header files (or libraries!).  You
probably want to put one or more -Ipath/to/my/headers/directory and
-Lpath/to/my/libraries/directory on the g++ command line.

Run 'man g++'.

> As for my own project, using VC6 I always have to set the project settings as 
> follows:
> - dump the files (main.cpp, windows.cpp, drawstuff.cpp) as well as several 
> header files (drawstuff.h, internal.h, resource.h) in the working directory. 
> Add the .cpp files to the Source in the workspace.
> - add OpenGL by adding this line under the Project Settings/Link  - 
> object/library modules section (opengl32.lib glu32.lib /nodefaultlib:"libc")
> - under Resource Files in the workspace add ode.lib and resources.rc
> 
> So what the heck is the command line to do all that under unix?? :)

You fairly definitely want to write a makefile... You don't want
to be typing out a chain of command-lines to build you code! (unless
it's very simple)

See 'man g++' (or another source of the gcc/g++ documentation) for
the various command-line options for where to find and put files
used during compilation.

See some other online document concerning how to write makefiles. :)
Makefiles specify a combination of how to build the various
componants of a project and their interdependancies.  ODE itself
contains a (fairly complex) makefile for building ODE's libraries
and demos with build configuration options sucked from user-config,
etc.  A makefile is a good way to templatize the command-line options
used throughout a project.

Subsequently it's just a matter of typing 'make' to rebuild the
invalidated parts of your project.

I attach a small simple Makefile that I use for one of my
projects, as an example.  Note that this mailing list isn't really
a good forum for basic non-ODE problems.

Regards,
--Adam
-- 
Adam D. Moss   . ,,^^   adam@gimp.org   http://www.foxbox.org/   co:3

--------------070308080907030305030109
Content-Type: text/plain;
 name="Makefile.example"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="Makefile.example"


CC = gcc
COPTS = -O2 -Wall

CFLAGS = $(COPTS) $(INCS)

EXEC = testblend

OBJ_SRCS = testblend.c readblend.c
OBJ_OBJS = $(OBJ_SRCS:.c=.o)

all: $(EXEC)

%.o: %.c
	${CC} ${CFLAGS} -c $< -o $@

clean:
	rm -f $(EXEC) *.o gmon.out

$(EXEC): $(OBJ_OBJS)
	$(CC) $(CFLAGS) $^ -o $@


--------------070308080907030305030109--