Memory error for C++ runtime

17 views
Skip to first unread message

Andy

unread,
Jan 2, 2019, 7:04:02 PM1/2/19
to antlr-discussion
 I have compiled pascal.g4 by java -jar antlr-4.7.2-complete.jar -Dlanguage=pascal.g4
(I must change bool to bool_)
Sources compiled.
But when run: is error at line dfa::Vocabulary pascalLexer::_vocabulary(_literalNames, _symbolicNames); (L212)
I can't better locate because I don't have sources of runtime C++.
Where are available sources of C++ runtime?

Andy

unread,
Jan 2, 2019, 7:07:25 PM1/2/19
to antlr-discussion

Andy

unread,
Jan 2, 2019, 7:54:16 PM1/2/19
to antlr-discussion
Is error in version 4.7.2
Vocabulary::Vocabulary(const std::vector<std::string> &literalNames, const std::vector<std::string> &symbolicNames)
: Vocabulary(literalNames, symbolicNames, {}) {
}

Vocabulary::Vocabulary(const std::vector<std::string> &literalNames,
  const std::vector<std::string> &symbolicNames, const std::vector<std::string> &displayNames)
ERROR--------------->  : _literalNames(literalNames), _symbolicNames(symbolicNames), _displayNames(displayNames),
    _maxTokenType(std::max(_displayNames.size(), std::max(_literalNames.size(), _symbolicNames.size())) - 1) {
  // See note here on -1 part: https://github.com/antlr/antlr4/pull/1146
}

In last version is error:
e:\Antrl\crunt\src\Severity    Code    Description    Project    File    Line    Suppression State
Error    LNK2001    unresolved external symbol "protected: virtual class std::vector<class antlr4::dfa::DFAState::PredPrediction *,class std::allocator<class antlr4::dfa::DFAState::PredPrediction *> > __cdecl antlr4::atn::ParserATNSimulator::
getPredicatePredictions(class antlrcpp::BitSet const &,class std::vector<class std::shared_ptr<class antlr4::atn::SemanticContext>,class std::allocator<class std::shared_ptr<class antlr4::atn::SemanticContext> > >)" (?getPredicatePredictions@ParserATNSimulator@atn@antlr4@@MEAA?AV?$vector@PEAVPredPrediction@DFAState@dfa@antlr4@@V?$allocator@PEAVPredPrediction@DFAState@dfa@antlr4@@@std@@@std@@AEBVBitSet@antlrcpp@@V?$vector@V?$shared_ptr@VSemanticContext@atn@antlr4@@@std@@V?$allocator@V?$shared_ptr@VSemanticContext@atn@antlr4@@@std@@@2@@5@@Z)    test    e:\Antrl\test\pascalParser.obj    1


In https://github.com/antlr/antlr4/blob/master/doc/cpp-target.md is obsolete
using namespace org::antlr::v4::runtime; whereas need using namespace org::antlr4;

Andy

unread,
Jan 2, 2019, 8:05:46 PM1/2/19
to antlr-discussion
Runtime error was for VS2015, but for VS2017 is OK.
Error - static initialization of vector?

Mike Lischke

unread,
Jan 3, 2019, 4:31:01 AM1/3/19
to 'Fred Curts' via antlr-discussion
Hi Andy,
In your first message you wrote the parser compiled, now you present a linker error. I don't have my Windows machine at hand atm. and it compiles with clang (in XCode), so I'm a bit clueless. However, it is probably something simple. A not exported type or a signature changed or something like that. Can you try to figure that out?



In https://github.com/antlr/antlr4/blob/master/doc/cpp-target.md is obsolete
using namespace org::antlr::v4::runtime; whereas need using namespace org::antlr4;

Actually only `using namespace antlr4;`. I'll take care of that, thanks.


Andy

unread,
Jan 3, 2019, 9:11:49 AM1/3/19
to antlr-discussion

W dniu czwartek, 3 stycznia 2019 10:31:01 UTC+1 użytkownik Mike Lischke napisał:
Hi Andy,


In your first message you wrote the parser compiled, now you present a linker error. I don't have my Windows machine at hand atm. and it compiles with clang (in XCode), so I'm a bit clueless. However, it is probably something simple. A not exported type or a signature changed or something like that. Can you try to figure that out?

Maybe it is connected to c++ version? In C++17 is Ok, else we have static initialization of vector.
Reply all
Reply to author
Forward
0 new messages