error compiling in VC2010

closed account (2EyCpfjN)
While attempting to compile in Microsoft Visual C++ 2010 Express I was given this error:

error LNK2001: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > * message" (?message@@3PAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@A) C:\Users\*****\Desktop\Project_Name\Project_Name.obj


and this error:

error LNK1120: 1 unresolved externals C:\Users\*****\Desktop\Project_Name\Debug\Project_Name.exe
(for line 1)
line one and two had the following code:
1
2
// Project_Name.cpp : Defines the entry point for the console application.
// 


The build had no messages or warnings. These were the only two errors. For more information please reply or private message. I'd rather not give too much information on this project.
Last edited on
Is message a global or static member? If so, you need to define it, as well as declare it.
1
2
3
4
5
//global:
std::string *message;

//static member:
std::string *ClassType::message;
Do not define it in a header. Do it in a source file.
Topic archived. No new replies allowed.