Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error in designing a class

Status
Not open for further replies.

gacaccia

Technical User
Joined
May 15, 2002
Messages
258
Location
US
hi all,

i'm learning c/c++ right now and was trying to make a "logFile" class. it's far from finished, but i keep getting an error message for one line and i don't understand what it wants. here's my code so far...

Code:
#pragma once

class logFile
{
public:
	logFile(char*);
	~logFile(void);

	void write(char*);
	void writeln(char*);

private:
	ofstream itsFile;
	char itsName[30];
};

when i go to build this, it keeps erroring on the "ofstream itsFile;" line, saying "C2146: syntax error : missing ';' before identifier 'itsFile'".

how do i fix this?

thanks,

glenn
 
ok, never mind. i was including the fstream library in the .cpp part of the class instead of in the .h part of the class. works now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top