Wednesday, 21 May 2014

-ll linker flag not working


hello everyone! casual xcode user, version 3, switched version 4 in december. taking compiler writing course , our initial homework uses lex , yacc.

terminal window can compile lex output file , execute using:

gcc lex.yy.c -ll

gcc being used from: /developer/usr/bin , version

i686-apple-darwin11-llvm-gcc-4.2

putting same file xcode project , trying compile returns apple mach-o linker (ld) error:
ld: library not found -ll
command /developer/usr/bin/llvm-gcc-4.2 failed exit code 1

added -ll link flag in "linking" area of "build settings" under "other linker flags" option line , see getting included in gcc command line. tried using both llvm gcc 4.2 , apple llvm compiler 3.0 selected compiler in "build options->compiler" field. tried using -llibl rather -ll, did not work either.

want able use xcode assignments later in course don't have work directly gdb. suggestions how xcode locate lex , yacc libraries appreciated!!!
 

instead of trying add explicit library flag, try telling xcode link library instead.

  1. remove -ll other linker flags
  2. click on project node @ top of project navigator
  3. click on target in project editor
  4. click on build phases tab
  5. expand link binary libraries
  6. click + button @ bottom of link binary libraries
  7. click add other button
  8. press shift+command+g
  9. enter /usr/lib , click go button
  10. select libl.a
  11. click open button

notice it's not libl.a gets linked in, it's libfl.a. because libl.a symlink libfl.a. you've not been using lex, rewritten , extended flex.
 


Forums Macs Mac Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

No comments:

Post a Comment