* popt, ELDK 2.0.2
@ 2003-10-06 10:51 robdlg
2003-10-06 17:10 ` Wolfgang Denk
0 siblings, 1 reply; 2+ messages in thread
From: robdlg @ 2003-10-06 10:51 UTC (permalink / raw)
To: linuxppc-embedded
I was experimenting with the popt library in the ELDK 2.0.2, and I received
the following errors. The same compiler invocation is successful when used
with gcc under Red Hat Linux 7.3. The source code follows the error
messages. How do I properly compile and link this file?
ppc_82xx-gcc -Wall -lpopt -o popt_test main.c
/tmp/ccMrZmW2.o: In function `main':
/tmp/ccMrZmW2.o(.text+0x60): undefined reference to `poptGetContext'
/tmp/ccMrZmW2.o(.text+0x60): relocation truncated to fit: R_PPC_REL24
poptGetContext
/tmp/ccMrZmW2.o(.text+0x70): undefined reference to `poptGetNextOpt'
/tmp/ccMrZmW2.o(.text+0x70): relocation truncated to fit: R_PPC_REL24
poptGetNextOpt
/tmp/ccMrZmW2.o(.text+0x94): undefined reference to `poptFreeContext'
/tmp/ccMrZmW2.o(.text+0x94): relocation truncated to fit: R_PPC_REL24
poptFreeContext
collect2: ld returned 1 exit status
make: *** [all] Error 1
#include <stdio.h>
#include <stdlib.h>
#include <popt.h>
int main(int argc, char *argv[])
{
int rc;
/* command-line arguments */
struct poptOption options[] = {
{ "help", 'h', POPT_ARG_NONE, NULL, 1 },
{ NULL, 0, 0, NULL, 0 }
};
poptContext context;
context = poptGetContext(NULL, argc, (const char **)argv, options,
0);
rc = poptGetNextOpt( context );
printf("%d\n", rc);
poptFreeContext( context);
return 0;
}
/* eof */
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: popt, ELDK 2.0.2
2003-10-06 10:51 popt, ELDK 2.0.2 robdlg
@ 2003-10-06 17:10 ` Wolfgang Denk
0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Denk @ 2003-10-06 17:10 UTC (permalink / raw)
To: robdlg; +Cc: linuxppc-embedded
In message <200310061051.FAA10075@lists.linuxppc.org> you wrote:
>
> I was experimenting with the popt library in the ELDK 2.0.2, and I received
> the following errors. The same compiler invocation is successful when used
> with gcc under Red Hat Linux 7.3. The source code follows the error
> messages. How do I properly compile and link this file?
>
> ppc_82xx-gcc -Wall -lpopt -o popt_test main.c
You must specify the linked objects in the correct order. This means
(among other things) that you have to put the libraries AFTER the
object files that have references to symbols provided by these libs.
Try:
ppc_82xx-gcc -Wall -o popt_test main.c -lpopt
And RTFM.
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd@denx.de
Vulcans believe peace should not depend on force.
-- Amanda, "Journey to Babel", stardate 3842.3
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-10-06 17:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-06 10:51 popt, ELDK 2.0.2 robdlg
2003-10-06 17:10 ` Wolfgang Denk
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.