Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > compliling error in porting linux program

compliling error in porting linux program
Thread Tools
surfacto
Dedicated MacNNer
Join Date: Oct 2001
Location: California
Status: Offline
Reply With Quote
Jul 28, 2003, 11:15 AM
 
Can anyone please help me decipher this error?

I installed gnugetopt using fink and then copied getopt.h to /usr/include/getopt.h. This is what I see when I type make:

g++3 --ansi -Wall -Wnon-virtual-dtor -Wno-long-long -Wundef -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -ansi -Wcast-align -g -pedantic -o flic dispersion_set.o layer_system.o transfer_matrix.o setupfile.o fl_layer_system.o spectrum.o data_set.o interference_terms.o fl_layer_system_tools.o flic.o -lncurses -lstdc++
ld: Undefined symbols:
_getopt_long
make: *** [flic] Error 1

A previous poster said that using gnugetopt solved this problem, but it didn't seem to work for me.
     
Arkham_c
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Jul 28, 2003, 12:44 PM
 
Originally posted by surfacto:
Can anyone please help me decipher this error?

I installed gnugetopt using fink and then copied getopt.h to /usr/include/getopt.h. This is what I see when I type make:

g++3 --ansi -Wall -Wnon-virtual-dtor -Wno-long-long -Wundef -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -ansi -Wcast-align -g -pedantic -o flic dispersion_set.o layer_system.o transfer_matrix.o setupfile.o fl_layer_system.o spectrum.o data_set.o interference_terms.o fl_layer_system_tools.o flic.o -lncurses -lstdc++
ld: Undefined symbols:
_getopt_long
make: *** [flic] Error 1

A previous poster said that using gnugetopt solved this problem, but it didn't seem to work for me.
The error means that the symbol _getopt_long is not in the library as it should be. It could be caused by the fact that your version of getopt is different from the one that the compiled code expects. Somewhere up your link line, one of your .o files linked against the getopt library. That's your culprit.

As to how to fix it, you need to figure out why the source thinks that symbol should be in your library but isn't.

You can use the CLI tool "nm" to list out the symbol table for a library.
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
   
Thread Tools
 
Forum Links
Forum 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
Top
Privacy Policy
All times are GMT -4. The time now is 04:24 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,