Click here to Skip to main content
16,017,261 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHelp for making a DLL Pin
Sunil KC16-May-07 23:19
Sunil KC16-May-07 23:19 
AnswerRe: Help for making a DLL Pin
Hamid_RT17-May-07 1:35
Hamid_RT17-May-07 1:35 
GeneralRe: Help for making a DLL Pin
Sunil KC17-May-07 21:00
Sunil KC17-May-07 21:00 
GeneralRe: Help for making a DLL Pin
Hamid_RT18-May-07 2:09
Hamid_RT18-May-07 2:09 
Question"application failed to initialize properly(0xc0000142)" error in Vista [modified] Pin
rp_suman16-May-07 22:56
rp_suman16-May-07 22:56 
AnswerRe: 0xc0000142 error in Vista Pin
Paresh Chitte16-May-07 23:58
Paresh Chitte16-May-07 23:58 
GeneralRe: 0xc0000142 error in Vista Pin
rp_suman17-Jun-07 3:00
rp_suman17-Jun-07 3:00 
Questionneed some help on the friend functions Pin
nethp102016-May-07 22:53
nethp102016-May-07 22:53 
I am trying to overload the ">>" and "<<" with two friend functions, and I am receiving 14 errors during the compile time. Anybody could help me out? thanks!!!

Here are the error messages I've received:
============================================================================
--------------------Configuration: IntegerSet - Win32 Debug--------------------<br />
Compiling...<br />
IntegerSet.cpp<br />
c:\documents and settings\administrator\Desktop\project4_c++\integerset.h(19) : error C2143: syntax error : missing ';' before '&'<br />
c:\documents and settings\administrator\Desktop\project4_c++\integerset.h(19) : error C2433: 'istream' : 'friend' not permitted on data declarations<br />
c:\documents and settings\administrator\Desktop\project4_c++\integerset.h(19) : error C2501: 'istream' : missing storage-class or type specifiers<br />
c:\documents and settings\administrator\Desktop\project4_c++\integerset.h(19) : error C2244: 'istream' : unable to resolve function overload<br />
c:\documents and settings\administrator\Desktop\project4_c++\integerset.h(19) : error C2061: syntax error : identifier 'istream'<br />
c:\documents and settings\administrator\Desktop\project4_c++\integerset.h(19) : error C2501: '>>' : missing storage-class or type specifiers<br />
c:\documents and settings\administrator\Desktop\project4_c++\integerset.h(19) : error C2805: binary 'operator >>' has too few parameters<br />
c:\documents and settings\administrator\Desktop\project4_c++\integerset.h(20) : error C2143: syntax error : missing ';' before '&'<br />
c:\documents and settings\administrator\Desktop\project4_c++\integerset.h(20) : error C2433: 'ostream' : 'friend' not permitted on data declarations<br />
c:\documents and settings\administrator\Desktop\project4_c++\integerset.h(20) : error C2501: 'ostream' : missing storage-class or type specifiers<br />
c:\documents and settings\administrator\Desktop\project4_c++\integerset.h(20) : error C2244: 'ostream' : unable to resolve function overload<br />
c:\documents and settings\administrator\Desktop\project4_c++\integerset.h(20) : error C2061: syntax error : identifier 'ostream'<br />
c:\documents and settings\administrator\Desktop\project4_c++\integerset.h(20) : error C2501: '<<' : missing storage-class or type specifiers<br />
c:\documents and settings\administrator\Desktop\project4_c++\integerset.h(20) : error C2805: binary 'operator <<' has too few parameters<br />
Error executing cl.exe.<br />
<br />
IntegerSet.exe - 14 error(s), 0 warning(s)

============================================================================

My header file:
#ifndef INTEGERSET_H<br />
#define INTEGERSET_H<br />
<br />
class IntegerSet<br />
{<br />
public:<br />
	int size;<br />
	int *arr;<br />
<br />
public:<br />
	IntegerSet();<br />
	IntegerSet(int m);<br />
	IntegerSet(int a[], int n);<br />
	IntegerSet operator+(IntegerSet s);<br />
	IntegerSet operator*(IntegerSet s);<br />
	IntegerSet operator-(IntegerSet s);<br />
	void insertElement(int k);<br />
	void removeElement(int m);<br />
	friend istream &operator>>(istream &is, const IntegerSet &s);<br />
	friend ostream &operator<<(ostream &os, const IntegerSet &s);<br />
	bool operator==(IntegerSet s);<br />
	bool operator!=(IntegerSet s);<br />
	bool operator>=(IntegerSet s);<br />
	bool operator<=(IntegerSet s);<br />
	bool isValid(int k);<br />
	~IntegerSet()<br />
	{<br />
		delete [] arr;<br />
	}<br />
};<br />
<br />
#endif

============================================================================


My two functions from the Implementation file.
istream &operator >>(istream &is, const IntegerSet &s)<br />
{<br />
	int value;<br />
	is >> value;<br />
	return is;<br />
}<br />
<br />
ostream &operator <<(ostream &os, const IntegerSet &s)<br />
{<br />
	os << "{ ";<br />
	for (int i = 0; i < 256; i++)<br />
		os << s.arr[i] << " ";<br />
	os << "}";<br />
	return os;<br />
}

AnswerRe: need some help on the friend functions Pin
Hans Dietrich17-May-07 0:10
mentorHans Dietrich17-May-07 0:10 
GeneralRe: need some help on the friend functions Pin
nethp102017-May-07 14:45
nethp102017-May-07 14:45 
QuestionHi all Pin
josip cagalj16-May-07 22:50
josip cagalj16-May-07 22:50 
AnswerRe: Hi all Pin
Paresh Chitte17-May-07 0:07
Paresh Chitte17-May-07 0:07 
GeneralRe: Hi all Pin
josip cagalj17-May-07 0:32
josip cagalj17-May-07 0:32 
GeneralRe: Hi all Pin
Paresh Chitte17-May-07 0:41
Paresh Chitte17-May-07 0:41 
AnswerRe: Hi all Pin
josip cagalj17-May-07 0:59
josip cagalj17-May-07 0:59 
GeneralRe: Hi all Pin
Mark Salsbery17-May-07 5:53
Mark Salsbery17-May-07 5:53 
QuestionRe: Hi all Pin
Hamid_RT17-May-07 6:47
Hamid_RT17-May-07 6:47 
AnswerLast msg Pin
josip cagalj17-May-07 22:02
josip cagalj17-May-07 22:02 
QuestionProblem with code on Reading Files :( Pin
Immunity1816-May-07 22:32
Immunity1816-May-07 22:32 
AnswerRe: Problem with code on Reading Files :( Pin
Hamid_RT16-May-07 22:37
Hamid_RT16-May-07 22:37 
GeneralRe: Problem with code on Reading Files :( Pin
Immunity1816-May-07 22:41
Immunity1816-May-07 22:41 
Questionslow scrollbar Pin
Aint16-May-07 22:13
Aint16-May-07 22:13 
AnswerRe: slow scrollbar Pin
Mark Salsbery17-May-07 5:56
Mark Salsbery17-May-07 5:56 
AnswerRe: slow scrollbar Pin
Nelek17-May-07 20:15
protectorNelek17-May-07 20:15 
QuestionImages in CListCtrl Pin
anilkrupakar16-May-07 21:58
anilkrupakar16-May-07 21:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.