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

Re: Help with compiling



On Thu, Aug 26, 1999 at 01:41:20PM -0700, Dan Smith wrote:
> I have downloaded and installed g++ and binutils and
> all the packages they depend on.  How do I compile and
> link a C++ program?  e.g. what is the proper syntax of
> the c++ and ld commands?
> Please send answers to me directly
> (dyson_sphere_explorer@yahoo.com) as I am not
> subscribed to the list.  Thank you.

You shouldn't have to invoke ld directly. To compile a program
consisting of foo.c, foo2.c, and foo3.c which depends on the gtk and
mysql libraries (hypothetical), you'd probably want to do something like
this:
g++ -O2 -Wall -pedantic -ansi -c foo.c
g++ -O2 -Wall -pedantic -ansi -c foo2.c
g++ -O2 -Wall -pedantic -ansi -c foo3.c
g++ -o foo_program foo.o foo2.o foo3.o -lgtk -lmysqlclient

or this:
g++ -O2 -Wall -pedantic -ansi -o foo_program foo.c foo2.c foo3.c -lgtk -lmysqlclient


--
Stephen Pitts
smpitts@midsouth.rr.com
webmaster - http://www.mschess.org


Reply to: