public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Simple linking problem
@ 2007-05-10 11:00 gccNewbie
  2007-05-10 11:07 ` Andrew Haley
  0 siblings, 1 reply; 12+ messages in thread
From: gccNewbie @ 2007-05-10 11:00 UTC (permalink / raw)
  To: gcc-help


After spending years working in Java, I've decided I'd like to do a little C
programming. I've gotten gcc, which I think is the first step. In fact, I'm
using an old version, 3.2.3 for MinGW. I've done "Hello world" just to be
sure gcc is working. Now I'm trying to get gcc to link.

I've studed all the options, all the ways to invoke gcc, and I can find
nothing helpful. I've got a library in a file starting with 'lib' and ending
with '.a'. I've downloaded this file from the web, I've downloaded the
source and used the makefile to compile the library. It seems that no matter
what I do I cannot get gcc to treat this file as a library containing the
stuff that I am absolutely sure it is supposed to contain.

I know gcc is finding the file. If I go "gcc -lblah" and it cannot find
libblah.a, it will give me an error that tells me the library wasn't found.
So the library file is found. I see nothing in the documentation that
suggests I should need to do anything more than "gcc -lmylib test.c" to
compile 'test.c' with the functions defined in mylib. I have the library, I
tell gcc to use the library, and yet it acts as though these library
functions are undefined, giving 'undefined reference to' messages.

I've looked at all the documentation I can think to study without finding
any possible solution. Is there any way to get gcc to tell me exactly what
is really in the library file? I can use 'ar' to discover the file names
that make up the library, but I'd like to know the function names that are
in there so I can tell if gcc is to blame or if the library really doesn't
have the things that gcc says it doesn't have.

This has got to be a simple problem. I'd just like a hint about where to
look for the cause. What do you do when gcc tells you that something is
undefined even though you know that it's defined?
-- 
View this message in context: http://www.nabble.com/Simple-linking-problem-tf3720892.html#a10410954
Sent from the gcc - Help mailing list archive at Nabble.com.

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

end of thread, other threads:[~2007-05-23 17:23 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-10 11:00 Simple linking problem gccNewbie
2007-05-10 11:07 ` Andrew Haley
2007-05-10 11:38   ` gccNewbie
2007-05-10 11:40     ` John (Eljay) Love-Jensen
2007-05-10 11:42     ` Andrew Haley
2007-05-10 16:00     ` Matthew Woehlke
2007-05-10 18:18       ` gccNewbie
2007-05-10 18:27         ` Doc is misleading (was: Simple linking problem) Matthew Woehlke
2007-05-10 18:36           ` Doc is misleading David Daney
2007-05-10 19:08             ` Matthew Woehlke
2007-05-23 16:04               ` Ian Lance Taylor
2007-05-23 21:45                 ` Matthew Woehlke

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).