Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C++] Mingw. Link errors in Release configuration. #3577

Closed
ArsenyVelichko opened this issue Mar 10, 2022 · 0 comments
Closed

[C++] Mingw. Link errors in Release configuration. #3577

ArsenyVelichko opened this issue Mar 10, 2022 · 0 comments

Comments

@ArsenyVelichko
Copy link

I tried to build my C++ application together with the corresponding ANTLR-runtime library under mingw 9.0 and encountered the following link errors in the Release configuration:

C:/Qt/Tools/mingw900_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 
CMakeFiles/RailDSL.dir/antlr/MetaGrammar/MetaGrammarLexer.cpp.obj:MetaGrammarLexer.cpp:(.text+0x714):
undefined reference to `antlr4::atn::LexerATNSimulator::SimState::~SimState()'
C:/Qt/Tools/mingw900_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
CMakeFiles/RailDSL.dir/antlr/MetaGrammar/MetaGrammarLexer.cpp.obj:MetaGrammarLexer.cpp:
(.text$_ZN6antlr43atn17LexerATNSimulatorD0Ev[_ZN6antlr43atn17LexerATNSimulatorD0Ev]+0x1c): 
undefined reference to `antlr4::atn::LexerATNSimulator::SimState::~SimState()'
C:/Qt/Tools/mingw900_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 
CMakeFiles/RailDSL.dir/antlr/MetaGrammar/MetaGrammarParser.cpp.obj:MetaGrammarParser.cpp:(.text+0x3e56):
undefined reference to `antlr4::atn::LexerATNSimulator::SimState::~SimState()'
C:/Qt/Tools/mingw900_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 
CMakeFiles/RailDSL.dir/antlr/MetaGrammar/MetaGrammarParser.cpp.obj:MetaGrammarParser.cpp:(.text+0x3ed6):
undefined reference to `antlr4::atn::LexerATNSimulator::SimState::~SimState()'

Referring to the LexerATNSimulator.h header file, I noticed that the ANTLR4CPP_PUBLIC macro was missing from the nested class.

class ANTLR4CPP_PUBLIC LexerATNSimulator : public ATNSimulator {
protected:
class SimState {

After adding this macro, link errors disappeared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant