• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [UPDATE] Lex/Yacc and Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [UPDATE] Lex/Yacc and Cocoa


  • Subject: Re: [UPDATE] Lex/Yacc and Cocoa
  • From: Sherm Pendley <email@hidden>
  • Date: Fri, 19 Aug 2005 23:56:04 -0400

On Aug 19, 2005, at 10:15 PM, Miguel Arroz wrote:

I noticed that it I remove the include Cocoa/Cocoa.h directive, gcc will signal all the expected errors (my errors, and the errors related to ObjC classes not found). So it's the Cocoa/Cocoa.h directiva that is causing the problem... i'm lost here!

By default, both Lex & Yacc generate files with a .c extension, so they're compiled as C instead of Objective-C.


I worked around that by adding two custom build rules to my target:

1. Process: Lex source files
using: Custom script:
/usr/bin/flex -o${DERIVED_FILES_DIR}/$ {INPUT_FILE_BASE}.yy.cpp -P${INPUT_FILE_BASE}_ ${INPUT_FILE_PATH}
with output files:
$(DERIVED_FILES_DIR)/$(INPUT_FILE_BASE).yy.cpp


2. Process: Yacc source files
using: Custom script:
/usr/bin/yacc -d -b ${INPUT_FILE_BASE} -o $ {DERIVED_FILES_DIR}/${INPUT_FILE_BASE}.tab.cpp -p ${INPUT_FILE_BASE}_ ${INPUT_FILE_PATH}
with output files:
$(DERIVED_FILES_DIR)/$(INPUT_FILE_BASE).tab.cpp
$(DERIVED_FILES_DIR)/$(INPUT_FILE_BASE).tab.h


Note that I'm using C++, not Objective-C, so the above has .cpp extensions. And, I needed more than one parser in my app, and I wanted Yacc to generate my token #defines for me, and the relevant options are included above.

sherm--

Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: [UPDATE] Lex/Yacc and Cocoa
      • From: Damien Bobillot <email@hidden>
References: 
 >Lex/Yacc and Cocoa (From: Miguel Arroz <email@hidden>)
 >[UPDATE] Lex/Yacc and Cocoa (From: Miguel Arroz <email@hidden>)

  • Prev by Date: background screen of the other application
  • Next by Date: Re: Running a tool authorized as root
  • Previous by thread: [UPDATE] Lex/Yacc and Cocoa
  • Next by thread: Re: [UPDATE] Lex/Yacc and Cocoa
  • Index(es):
    • Date
    • Thread