• Advertisement

Archived

This topic is now archived and is closed to further replies.

What does this error mean?

This topic is 5759 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I keep getting the following error in Borland C++ when I try to compile my program: Module.h(21,3):Cannot create pre_compiled header: code in header What does this mean? Here's the header file that causes the error:
  
//Class declaration

class Module
{
   public:
   	Module *next;
        Module *prev;
   	void set_name(char *);
        void set_semester(int);
	char *get_name();
        int get_semester();

   private:
   	char name[40];
        int semester;
};
//End of class declaration


//Member functions definition

void Module::set_name(char *supp_name)
{
	strcpy(name, supp_name);
};

void Module::set_semester(int supp_semester)
{
	semester = supp_semester;

};

char *Module::get_name()
{
	return(name);
};

int Module::get_semester()
{
	return(semester);
};
//End of member functions definition


  
[edited by - blue_harvester on April 17, 2002 2:28:46 PM]

Share this post


Link to post
Share on other sites
Advertisement
The problem is that you can''t write code in headers.

You have to split the header. Leave the class declaration in the header and move the class code to a .c file.

Share this post


Link to post
Share on other sites

  • Advertisement