help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

M-x compile problem (path problem)


From: Eric Lilja
Subject: M-x compile problem (path problem)
Date: Tue, 15 Mar 2005 21:20:16 +0100

Hello, I'm using the "CVS version" 22.0.50.1 (from early february) and I 
recently encountered a problem with M-x compile. I'm using emacs to write 
code for, compile and debug c and c++.

Anyway, before I had the Makefile and all sources files in the same 
directory and all files generated during the build process (object files, 
executable etc) was created in that directory. I decided that I should place 
all source files in subdirectory called source and all generated object 
files should go in a subdirectory called obj. So in the "primary" directory 
I would have just the Makefile, the compiled executable and the two 
subdirectories src/ and obj/. I changed my Makefiles to look for the source 
files in the src/ subdirectory and to place the object files in the obj/ 
subdirectory.

But then when I tried to use debug mode (M-x gdb) it didn't find a symbol 
table but I solved that by adding ../name_of_executable to
Run gdb (like this): gdb --annotate=3 ../name_of_executable

If I try compile mode (M-x compile) it doesn't work because it cant find the 
Makefile, so I added -f ../Makefile but it still won't work because the 
paths in the Makefile are relative paths to the parent directory of the src/ 
subdirectory. So how do I solve this problem? I can see three solutions, and 
I don't like any of those three.
1. Edit the Makefile so that the paths in it are relative to the src 
directory, but then I can't compile if from the shell if I'm not in the src 
directory.
2. Have two Makefiles, where the second one is the src directory with 
relative paths adapted to its location.
3. Go back to keep everything in the same directory but I dont want that.

Anyone have any other solutions??

Ouch, this got longish, hope you understood my problem

/ Eric 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]