Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi I am trying to use a wstring variable in various classes so I thought if I put it in a header file under public I would be able to use it.

I have got this ->

C++
#ifndef _TWITTER_H_
#define _TWITTER_H_

class Twitter
{
public:
	void call();
	void run_internal();
	wstring newName;
};
#endif


But i get these errors ->

Error 20 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int engine\twitter.h 9 1 Engine

and

Error 19 error C2146: syntax error : missing ';' before identifier 'newName' \engine\twitter.h 9 1 Engine

I am quite confused as I don't know why.

Any help would be appreciated.

Mark
Posted

You either include the string header in your header file or, alternatively, include it before twitter.h in every source file using it.
Of course you need also the using namespace std; directive.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 30-Apr-15 15:27pm    
5ed.
—SA
you must include the header at the top in which the wstring is declared.

like
#include <string>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900