Global variables

L

Lamefif

hi all ..im doing something like this:

//----Globals.h-----------
#ifndef __GLOBALS_H
#define __GLOBALS_H
#include <vector>

struct alert {
CString descriptionc;
int year;
int month;
int day;
int hour;
int min;
int sec;
bool triggered;
};
extern std::vector<alert> alertVector;


#endif
//---------------------------------------------
LINKER ERRORS:
class std::vector<struct alert,class std::allocator<struct alert> >
alertVector" (?alertVector@@3V?$vector@Ualert@@V?
$allocator@Ualert@@@std@@@std@@A)
fatal error LNK1120: 1 unresolved externals

----
error LNK2001: unresolved external symbol "class std::vector<struct
alert,class std::allocator<struct alert> > alertVector" (?
alertVector@@3V?$vector@Ualert@@V?$allocator@Ualert@@@std@@@std@@A)
reminder_v1Dlg.obj


any help thanks.
 
L

Lionel B

hi all ..im doing something like this:

//----Globals.h-----------
#ifndef __GLOBALS_H
#define __GLOBALS_H
#include <vector>

struct alert {
CString descriptionc;
int year;
int month;
int day;
int hour;
int min;
int sec;
bool triggered;
};
extern std::vector<alert> alertVector;

You have declared alertVector to be `extern' in your header. I would
guess that you have not *defined* it anywhere. It must have a single
definition in some compilation unit. You probably want:

std::vector<alert> alertVector;

in some .cpp file.

[...]
 
L

Lamefif

hi all ..im doing something like this:
//----Globals.h-----------
#ifndef __GLOBALS_H
#define __GLOBALS_H
#include <vector>
struct alert {
CString descriptionc;
int year;
int month;
int day;
int hour;
int min;
int sec;
bool triggered;
};
extern std::vector<alert> alertVector;

You have declared alertVector to be `extern' in your header. I would
guess that you have not *defined* it anywhere. It must have a single
definition in some compilation unit. You probably want:

std::vector<alert> alertVector;

in some .cpp file.

[...]

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,830
Latest member
HeleneMull

Latest Threads

Top