Re: [Dev-C++] implementation .o procedure
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Carlos d. M. <cg...@wo...> - 2002-10-13 19:09:16
|
Santiago escribi=F3: > Hi, I only have DevC++, I don't know if it's possible to use the comman= ds > gcc -c a.c and gcc -c b.c in DevC++. Anyway I'm still stuck with the fi= rst > part of the process, creating a .o object file out of the implementatio= n of > a class I made. These are my questions again: Dev-C++ is the IDE for mingw, so you must be able to say gcc -c file.c, = you only need to have it in your path. > > 1- How do I create an object file using the implementation I created? I= want > someone else to use this object file so I don't have to give them my > implementation code. Just that, use the -c option, compile, not link. If you are speaking abou= g making one .o from various source files, that' not possible, or it should= n't (since the exe is done just by joining them) > > 2- Once the object file is created, how does the user use it to compile > his/her own client code? how does the user refer to the file in his/her > client code by using #include "myClass.h", or "myClass.o", or both, or = some > other way? #include "myClass.h", so it knows the functions used in the new code are = defined and will found its implementation somewhere in some of the files it will = link to. And ad myClass.o in the linker options/[...]object files tab of the f= irst tab of the project options. > > > I'll play class creator and main creator(user) myself using DevC++ for > testing purposes. > > I'll appreciate your help! > > Santiago > > ----- Original Message ----- > From: "Elizabeth Barham" <sog...@ya...> > To: "Santiago" <sa...@ho...> > Sent: Monday, October 07, 2002 11:02 AM > Subject: Re: [Dev-C++] implementation .o procedure > > > "Santiago" <sa...@ho...> writes: > > > > > Where do I add it? > > > as an #include in *my* code? > > > > It is when you link the executable. > > > > If you have two source files, a.c and b.c, and compile them like: > > > > gcc -c a.c > > gcc -c b.c > > > > you will have two files, a.o and b.o. Then it is a matter of linking > > them to produce the end file: > > > > gcc -o test.exe a.o b.o > > > > The #include is in your code because that defines the interface to > > myClass, which is all ready compiled and in object code format > > in myClass.o. > > > > So to produce the executable, you'll need to do something like: > > > > gcc -o test.exe a.o b.o myClass.o > > > > In Dev-C++, you can make this occur when building using the: > > > > Project > Project Options > > > > dialog and placing "myClass.o" in the field labeled, "Linker > > options/Optional Libs or Object Files" - the key words being "Object > > Files" in this case (files that have the .o extension). > > > > Elizabeth > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users Eeps! Just what Mrs Elizabeth says. (Didn't you prove that???????????????????????????????) |