[antlr-interest] Re: MSVC 7.0

Arnar Birgisson arnarb at oddi.is
Fri Oct 3 02:33:00 PDT 2003


Hello

Loring wrote:
> This looks more like a signed versus unsigned character 
> problem.  As a 
> signed "char", 0xf0 is -120 when converted to int, but as an unsigned 
> char value is 248.  MSVC should have a compiler flag which interprets 
> char as "unsigned char"; if not, Ric may be able to fix this pretty 
> quickly if you ask.

Indeed there is such a flag, /J. Enabling it in my project, in fact it
didn't matter there. However, the ANTLR dll must be built with this
flag. That solved it for me.

For future reference, here's how I built the ANTLR dll with MSVC 7.0,
based on Ric's modified ANTLR 2.7.3-20030911 (this is a little different
from the README):

1. Create new "Win32 Project"
2. In the creation wizard, under "Application Settings", check DLL as
application type and "Empty project" in "Additional Options"
3. Insert all *.cpp files from lib/cpp/src and *.hpp from lib/cpp/antlr
to your project.
4. Make these changes in Project properties:
    - Configuration Properties
      - C/C++
        - General
          - Additinal Include Directories: drive:\path-to-antlr\lib\cpp
        - Preprocessor
          - Preprocessor Definitions:
 
WIN32;NDEBUG;_WINDOWS;_USRDLL;ANTLR_EXPORTS;ANTLR_CXX_SUPPORTS_NAMESPACE
              ( change _DEBUG to NDEBUG in release build)
        - Code generation
          - Runtime Library: Multi-threaded Debug DLL  (Skip "debug" in
release build)
          - Enable Function-level Linking: Yes
        - Language
          - Default Char Unsigned: Yes
        - Create/Use Precompiled Header: Not using precompiled header
5. Compile

In your project, where you use ANTLR from, you need to select the same
Runtime Library, and define ANTLR_IMPORTS and
ANTLR_CXX_SUPPORTS_NAMESPACE.

Arnar


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list