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.
- remove -ll other linker flags
- click on project node @ top of project navigator
- click on target in project editor
- click on build phases tab
- expand link binary libraries
- click + button @ bottom of link binary libraries
- click add other button
- press shift+command+g
- enter /usr/lib , click go button
- select libl.a
- 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