I've been given the task of upgrading a VC++ 6.0 solution to VS C++ 2017. Based off of various articles on this site I've gotten the solution to build correctly using VS C++ 2010. But now when I try and upgrade the solution from VS 2010 to VS 2017 I'm getting a link error that I can't seem to figure out. The solution uses the old MS regexpr2 class. I've thought about ripping out the regexpr2 class and putting in something new, but figured I'd try and see if I could make things build first so as not to rock the boat to much.
The error on linking I'm getting is this:
1>regexpr2.obj : error LNK2001: unresolved external symbol "protected: static enum regex::TOKEN const * const regex::perl_syntax_base::s_rgreg" (?s_rgreg@perl_syntax_base@regex@@1QBW4TOKEN@2@B) 1>regexpr2.obj : error LNK2001: unresolved external symbol "protected: static enum regex::TOKEN const * const regex::perl_syntax_base::s_rgescape" (?s_rgescape@perl_syntax_base@regex@@1QBW4TOKEN@2@B)
If I look at the .map file from the VS 2010 successful build I can see this:
0002:00050550 ?s_rgreg@perl_syntax_base@regex@@1QBW4TOKEN@2@B 00000001801ce550 syntax2.obj 0002:00050a20 ?s_rgescape@perl_syntax_base@regex@@1QBW4TOKEN@2@B 00000001801cea20 syntax2.obj
In the Syntax.h file I see this:
class perl_syntax_base
{
protected:
perl_syntax_base()
{
}
static TOKEN const s_rgreg[ UCHAR_MAX + 1 ];
static TOKEN const s_rgescape[UCHAR_MAX + 1];
And various usages like this:
TOKEN tok = look_up( *icur, s_rgreg );
In the Syntax.cpp file I see this:
namespace regex
{
REGEX_SELECTANY TOKEN const perl_syntax_base::s_rgreg[ UCHAR_MAX + 1 ] =
{
/* 0*/ NO_TOKEN, NO_TOKEN, NO_TOKEN, NO_TOKEN, NO_TOKEN, NO_TOKEN, NO_TOKEN, NO_TOKEN,
...}
Also from from the Syntax2.h and Syntax.cpp files is this:
Syntax2.h
extern posix_charset_type const g_rgposix_charsets[];
Syntax2.cpp
namespace detail
{
REGEX_SELECTANY extern posix_charset_type const g_rgposix_charsets[] =
{
{ "[:alnum:]", 9 },
{ "[:^alnum:]", 10 },
...}
There is no link error with the g_rgposix_charsets variable, and from the .map file from VS2010 I can see this in the syntax2.obj file
it seems like this solutions were
error LNK2001: unresolved external symbol "private: static class
VS 2012 error LNK2001: unresolved external symbol
But as far as I can tell I am already initializing things appropriately.
Any idea why VS 2017 is complaining about this but VS 2010 successfully builds?
Thanks in advance