-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
VS2017 link error when using antlrcpp::Any #2211
Comments
I have the same problem, a wild guess might be the symbol is being not exported. (Plus, I don't see the point to put a do-nothing destructor in to a separate .cpp file.) |
I also had the same problem when extending the TParserBaseVisitor class with my own visitor class. The antlrcpp::Any::Base::~Base() in the .cpp file isn't seen by the linker for some reason. As @eternalphane suggested, copying the destructor definition inline into my custom Visitor class header file fixed the issue. I've only tested on VS2017, so not sure if the other VS versions are seeing the same problem. Maybe @mike-lischke can provide insight on the issue. |
Unfortunately, I missed the fact that the Any class is not exported, when I approved the patch which changed the d-tor. Previously it was a header only class. In fact I think now that move of the d-tor to a cpp file was unnecessary, mea culpa. So, the best solution is to move the d-tor back to the header. |
@mike-lischke I've made a pr for this issue. Please check #2213. Thanks. |
it still doesn't work but now with the move constructor for some reason. and a bunch of other functions.
|
tried the ParseTreeWalker and same problem with 3 functions. (constr/destr and walk) |
Yet another case of not compiled object code? Anyway, you should open a new issue instead of re-using a closed one. Maybe we should go C++17 and use their variant (or any) class? This will limit the user base to those having upgraded or are willing to upgrade to C++17, but being a bit progressive is not a bad thing anyway (and the previous version would still be available for those that don't want). |
I need to test the dynamic link first. but the fix is probably less drastic, like detecting static link and requiring to define |
@siliconvoodoo I've created a new PR (#2383) which adds VS 2017 project + solution files. They build fine for me for all targets (DLL, static lib, debug + release). See if that works for you too. |
Hello. I'm trying to use
antlrcpp::Any
and got the following errors when building with VS2017:Test.cpp:
However, if I move the definition of
antlrcpp::Any::Base::~Base()
inline, it works as expected. I don't know whether this is a bug of VS2017 or my usage ofantlrcpp::Any
is wrong in the above code. Could you please address this issue?The text was updated successfully, but these errors were encountered: