Fedora Linux Support Community & Resources Center
  #1  
Old 29th April 2008, 05:57 PM
daviddoria Offline
Registered User
 
Join Date: Oct 2007
Posts: 884
location of object files in makefile

I have two directories, A and B. The makefile in B needs to compile some things from B into .o file (still in B), but also some things from A. The problem is, it creates the Astuff.o in A, and therefore when it continues and tries to link there are errors (because it can't find all the .o files).

Is there a way to specify "force build .o file here"?

Thanks!

Dave
Reply With Quote
  #2  
Old 29th April 2008, 10:50 PM
cable_txg's Avatar
cable_txg Offline
Registered User
 
Join Date: Jan 2008
Posts: 302
Try using variables for your output files - it saves a lot of headache and searching. eg:

OBJ_FILES=/tmp/Object_Codes

Then link:
gcc -o $(OBJ_FILES)/myTest.o myTest.c

__________________
"Genius is one percent inspiration and 99 percent perspiration" --- Thomas Alva Edison.

Laptop: Intel i7, Geforce GT 425M, Blu-Ray :D
Laptop: Amd64 X2, Geforce Go 7600 Intel Core 2 Duo, Geforce 8600M GT
Desktop: :mad: Thanks Windows Vista! R.I.P. Sept. 2007 :mad:
Reply With Quote
  #3  
Old 29th April 2008, 10:52 PM
daviddoria Offline
Registered User
 
Join Date: Oct 2007
Posts: 884
you'd have to use -c instead of -o right?

but otherwise thats a good idea
Reply With Quote
  #4  
Old 30th April 2008, 05:45 PM
nspmangalore's Avatar
nspmangalore Offline
Registered User
 
Join Date: Nov 2006
Location: Mangalore, India
Posts: 241
no daviddoria,
it has to be -o, since thats the way you specify the path and name of the compiled file.
-c is required to compile the file into object files(these files may not be executable).
__________________
Linux user #452049 :D
Reply With Quote
  #5  
Old 30th April 2008, 05:49 PM
daviddoria Offline
Registered User
 
Join Date: Oct 2007
Posts: 884
right, thats what i want - object files , not executables

can you specify the name and path with -c ? or use -c and -o together ?
Reply With Quote
  #6  
Old 30th April 2008, 06:07 PM
nspmangalore's Avatar
nspmangalore Offline
Registered User
 
Join Date: Nov 2006
Location: Mangalore, India
Posts: 241
oh. in that case, use -c flag, followed by -o OUTPATH...

i.e.
gcc -c -o $(OBJ_FILES)/myTest.o myTest.c
__________________
Linux user #452049 :D
Reply With Quote
Reply

Tags
files, location, makefile, object

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Object Files C/C++ GeekyKitty Programming & Packaging 2 25th September 2009 11:59 PM
Trouble with WINE and shared object files Eggbertx Using Fedora 9 28th July 2009 04:02 PM
Using Apache and PHP the Document Object Model (DOM) is not generating XML files oloeriubogdan Servers & Networking 1 1st May 2009 09:05 AM
emacs extra .el files location ekdya Using Fedora 0 30th September 2006 09:32 PM
Location of Firefox files GaJim Using Fedora 2 2nd July 2006 08:19 PM


Current GMT-time: 09:49 (Wednesday, 22-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat