0

I am away from home using my notebook. I have installed Microsoft VS Community 2015 and Microsoft VS 2013 Express. I get the same error on both IDEs. I have tried both qualifying "++GlobalLineCount::glCount" and unqualifying "++glCount". I have retyped the text in case of some unseen character. I am not using precompiled headers. I have tried glCount both as pubic and private. This is pure C++. This code fails as is. It is an extraction of a larger program that also fails with the same error. The larger program does compile and link on my home PC using Microsoft VS Community 2015. Because the larger program behaves correctly on my home PC but not on this notebook I am suspicious of the IDE installed or configuration. Currently, I am 1500 miles from my home PC so doing anything with it is not possible. Thanks in advance.

My error:

TestGlobalLineCount.obj : error LNK2001: unresolved external symbol "public: static unsigned __int64 GlobalLineCount::glCount" (?glCount@GlobalLineCount@@2_KA)

My code:

#include <stdint.h>
#include <stdio.h>
#define MODULE_WHO_AM_I "TGLC"
class GlobalLineCount
{
public:
    static uint64_t getNextGLC(void)
        { return ++GlobalLineCount::glCount; } 
    static uint64_t glCount;
};
int main()
{
    printf("%-5s %4d %6llu - Test Start\n",
        MODULE_WHO_AM_I, __LINE__, GlobalLineCount::getNextGLC());
    return 0;
}
user3230672
  • 107
  • 1
  • 6

0 Answers0