unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* M-x compile problem (path problem)
@ 2005-03-15 20:20 Eric Lilja
  2005-03-15 21:27 ` Pascal Bourguignon
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Lilja @ 2005-03-15 20:20 UTC (permalink / raw)


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 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: M-x compile problem (path problem)
  2005-03-15 20:20 M-x compile problem (path problem) Eric Lilja
@ 2005-03-15 21:27 ` Pascal Bourguignon
  2005-03-15 22:47   ` Eric Lilja
  0 siblings, 1 reply; 3+ messages in thread
From: Pascal Bourguignon @ 2005-03-15 21:27 UTC (permalink / raw)


"Eric Lilja" <mindcooler_thisshouldberemoved@gmail.com> writes:
> [...]
> 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

Yes, or put a .gdbinit file along with the executable containing:

directory src

 
> 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 
> [...]
> Anyone have any other solutions??

        make -C .. 

which is equivalent to:

        cd .. ; make

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
Cats meow out of angst
"Thumbs! If only we had thumbs!
We could break so much!"

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: M-x compile problem (path problem)
  2005-03-15 21:27 ` Pascal Bourguignon
@ 2005-03-15 22:47   ` Eric Lilja
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Lilja @ 2005-03-15 22:47 UTC (permalink / raw)



"Pascal Bourguignon" wrote:
> "Eric Lilja" <mindcooler_thisshouldberemoved@gmail.com> writes:
>> [...]
>> 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
>
> Yes, or put a .gdbinit file along with the executable containing:
>
> directory src
>
>
>> 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
>> [...]
>> Anyone have any other solutions??
>
>        make -C ..
>
> which is equivalent to:
>
>        cd .. ; make
>
> -- 
> __Pascal Bourguignon__                     http://www.informatimago.com/
> Cats meow out of angst
> "Thumbs! If only we had thumbs!
> We could break so much!"

Thanks, Pascal, make -C .. works great, but I don't see what the .gdbinit 
file does for me...when doing M-x gdb I still have to point out the 
executable by passing ../name_of_exe to gdb.

/ Eric 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-03-15 22:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-15 20:20 M-x compile problem (path problem) Eric Lilja
2005-03-15 21:27 ` Pascal Bourguignon
2005-03-15 22:47   ` Eric Lilja

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).