//
//      Equation.h   define the equation class to be solved.
//

#ifndef EQUATION_H
#define EQUATION_H

#include "Mesh.h"
#include"Variable.h"
#include"Media.h"
#include"Simulation.h"
#include <string>
#include<vector>
#include <assert.h>
#include <iostream>
using namespace std;

class Equation
{
protected:
// the equation name it should be the same with the variaible name
	string name;
  
	// the equation residual
	double residual;

	// a pointer to the Mesh
   Mesh* pMesh;

	// a pointer to the varible soved in the equation
   Variable* pVariable;
    
  // a pointer to the simulation 
   Simulation* pSimulation;

   // a pointer to the media
   Media* pMedia;
	
   // the matrix A that contain the discretised equation Ax=source
	vector<double> csrA;

	// the source contain the discretised equation source term
	vector<double> source;
	
public:
	// the default constructor with no parameter
	Equation() { pVariable=new Variable();	int size=pMesh->getNbCells(); pVariable->setSize(size); source.resize(size); csrA.resize(pMesh->getNbNoneZero() );}
	 // the constructor with one parameter name 
	 Equation(const string& aName) { name=aName; pVariable=new Variable();int size=pMesh->getNbCells(); pVariable->setSize(size);source.resize(size); csrA.resize(pMesh->getNbNoneZero() );}

	~Equation(){pVariable->clear();delete pVariable;}

};
#endif

When i compile use the vs2008 , it gives me the following errror

1>------ Build started: Project: FlowingHeat, Configuration: Debug Win32 ------
1>Compiling...
1>main.cpp
1>g:\computation\c++cfd\flowingheat\flowingheat\equation.h(36) : error C2143: syntax error : missing ';' before '*'
1>g:\computation\c++cfd\flowingheat\flowingheat\equation.h(36) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>g:\computation\c++cfd\flowingheat\flowingheat\equation.h(36) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>g:\computation\c++cfd\flowingheat\flowingheat\equation.h(65) : error C2061: syntax error : identifier 'Simulation'
1>g:\computation\c++cfd\flowingheat\flowingheat\equation.h(65) : error C2065: 'pSimulation' : undeclared identifier
1>g:\computation\c++cfd\flowingheat\flowingheat\equation.h(65) : error C2065: 'apSimulation' : undeclared identifier

it seems it can not use the class Simlation, but i have include the header file"Simulation.h".
Could you please tell me how to resolve this problem.
Regards

Recommended Answers

All 3 Replies

Can you post "Simulation.h" ? Make sure you spelled if correctly

thank you very much. I have checked the spell many times. it is right.

thank you very much. I have checked the spell many times. it is right.

Post it. Also make sure you add a ';' after the end of class declaration as in,

class Simulation{
 //...
};
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.