Closed kaby76 closed 1 month ago
I've pushed what I currently have to the with-antlr branch. I don't know if I'm still missing something or not. The errors I mainly get now is for override specifiers not overriding a base class or method. Could I be missing an include somewhere?
What is the error, verbatim?
For example in RuleContext.h, antlr4::RuleContext::accept: method with override specifier 'override' did not ovveride any base class methods
and it's the same for getSourceInterval, getText, toString, and toStringTree. There are other headers that give similar errors but i'm sure if whatever I'm doing wrong for this get's fixed it'll fix the others too.
For example in RuleContext.h
First, it's impossible in VS2022 to compile a .h file. Visual Studio 2022 does not offer "Compile" when you right-click on the .h file in the Solution Explorer. You are compiling a .cpp file, and the compilation error appears in the .h, but it is in the context of compiling a .cpp. What .cpp file are you compiling? Also, is it a warning or error?
So, open the "Output" tab from the build, and copy and past the error message from column 1 all the way to the end. For example, 1>C:\msys64\home\Kenne\FortIDE-orig\mainfunc\Config.cpp(2,10): error C1083: Cannot open include file: 'imgui.h': No such file or directory
`1>(compiling source file 'mainfunc/mainfunc.cpp')
1>C:\Users\Peyton\Documents\dev\FortIDE\mainfunc\antlr-runtime\RuleContext.h(83,28): error C3668: 'antlr4::RuleContext::getSourceInterval': method with override specifier 'override' did not override any base class methods`
the compiling source file part came right before the error so I didn't know if that had something to do with it.
The error is the third or fourth error while compiling. As someone said, go to the very first error and solve that before going to something down the line.
The problem is a cascade of errors caused by the #define ERROR 0
in wingdi.h. You can see the includes analysis by going into the Solution Explorer, right-click on mainfunc.cpp, an then clicking on "Analyze Includes".
You can't include both windows.h and anything in antlr4 runtime. Wrap the antlr parser code in a separate file, and only expose a simplified API. In order to avoid exporting any data structures from the Antlr runtime, i.e., a parse tree, you will need to write wrappers that duplicate the functionality, e.g., a simplified parse tree with children. After a parse, you will need to convert the Antlr parse tree to that data structure, or provide an API that accesses what you want from the Antlr parse tree while keeping it hidden.
On line 22 of mainfunc\antlr-runtime\tree\xpath\XPath.cpp, the compiler outputs a compilation error:
Normally, you are expected to use the .vcxproj supplied with the runtime. That will build both a DLL and a static LIB, which you can link with your code.
But, instead, you decided to add all the runtime .cpp and .h to your project. In other words, they now need to be statically compiled.
If you go to line 22, and
right-click -> go to definition
of WILDCARD, you see that Visual Studio 2022 says the class is declared__declspec(dllimport)
. Now,right-cline -> go to definition
of ANTLR4CPP_PUBLIC you will see that it is declared incorrectly. You need to define ANTLR4CPP_EXPORTS.Go to the Solution Explorer and
right-click -> Properties
on Project FortIDE. Add ANTLR4CPP_STATIC to the set the C++ compiler preprocessor defined symbols. Then, go to Solution Explorer, right-click on XPath.cpp and compile. Works fine now.With this fix, all the Antlr4 runtime now mostly compiles, except for Vocabulary.cpp.