[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 955
  • Last Modified:

error LNK2001: unresolved external symbol

I have a GlobalV.h file with Static Variables listed.

These are called from various classes the variables as GlobalV::???variable name.

I now get the following errors, any ideas?

Error      40      error LNK2001: unresolved external symbol "public: static char * * GlobalV::gVComponentRecs" (?gVComponentRecs@GlobalV@@2PAPADA)      ListenMainHandler.obj
Error      41      error LNK2001: unresolved external symbol "public: static int GlobalV::gNComponentRecs" (?gNComponentRecs@GlobalV@@2HA)      ListenMainHandler.obj

Regards,

Josh
#pragma once
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <functional>
using namespace std;
class GlobalV
{
public:
	GlobalV(void);
	~GlobalV(void);
	
	static int  gNComponentvalues;
	static char **gVComponentvalues;
};
 
------------------------------------------------------------------------

Open in new window

0
supersuny2k
Asked:
supersuny2k
  • 2
2 Solutions
 
josgoodCommented:
I don't see a definition for gNComponentRecs in the header, but most likely you forgot to define it in the cpp
0
 
evilrixSenior Software Engineer (Avast)Commented:
You need something like below defined in a .cpp file to define your statics as currently they are only declared
int  GlobalV::gNComponentvalues = 0;
char ** GlobalV::gVComponentvalues = 0;

Open in new window

0
 
evilrixSenior Software Engineer (Avast)Commented:
0
 
supersuny2kAuthor Commented:
Brilliant Thank you
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now