Sign in to follow this  

order of includes??

This topic is 4202 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 have a file were I include other files from my program:
#include <windows.h>
#include <stdlib.h>						
#include <gl/gl.h>			
#include <gl/glu.h>

#include "NeHe.h"								
#include "text.h"

#include "CMenu.h"
#include "CController.h"

funny thing is, is that if I keep it how it's written then I get wierd errors from the fstream file. here's the CController:
#include <vector>
#include <windows.h>
#include <fstream>
#include <iomanip>
#include <gl\gl.h>		

#include "SVector2D.h"
#include "defines.h"
#include "CNeuralNet.h"
#include "CData.h"
#include "NeHe.h"
#include "text.h"

using namespace std;

//the program can be in one of three states.

class CController 


  //the neural network
  CNeuralNet*     m_pNet;

  //this class holds all the training data
  CData*          m_pData;
  //the user mouse gesture paths - raw and smoothed
  vector<POINTS> m_vecPath;
  vector<POINTS> m_vecSmoothPath;

  //the smoothed path transformed into vectors
  vector<double> m_vecVectors;

  //true if user is gesturing
  bool    m_bDrawing;

  //the highest output the net produces. This is the most
  //likely candidate for a matched gesture.
  double  m_dHighestOutput;

  //the best match for a gesture based on m_dHighestOutput
  int     m_iBestMatch;

  //if the network has found a pattern this is the match
  int     m_iMatch;

  //the raw mouse data is smoothed to this number of points
  int     m_iNumSmoothPoints;

  //the number of patterns in the database;
  int     m_iNumValidPatterns;

  //the current state of the program
  mode    m_Mode;

  //local copy of the application handle
  //HWND    m_hwnd;

  //clears the mouse data vectors
  void    Clear();
  //given a series of points whis method creates a path of 
  //normalized vectors
  void    CreateVectors();

  //preprocesses the mouse data into a fixed number of points
  bool    Smooth();

  //tests for a match with a prelearnt gesture
  bool    TestForMatch();
  //dialog box procedure. A dialog box is spawned when the user
  //enters a new gesture.
  //static BOOL CALLBACK DialogProc(HWND   hwnd,
  //                                UINT   msg,
  //                                WPARAM wParam,
  //                                LPARAM lParam);

  //this temporarily holds any newly created pattern names
  //static string m_sPatternName;



  //call this to train the network using backprop with the current data
  bool TrainNetwork();

  //renders the mouse gestures and relevant data such as the number
  //of training epochs and training error
  void Render();

  //returns whether or not the mouse is currently drawing
  bool Drawing()const{return m_bDrawing;}

  //this is called whenever the user depresses or releases the right
  //mouse button.
  //If val is true then the right mouse button has been depressed so all
  //mouse data is cleared ready for the next gesture. If val is false a
  //gesture has just been completed. The gesture is then either added to
  //the current data set or it is tested to see if it matches an existing
  //The hInstance is required so a dialog box can be created as a child
  //window of the main app instance. The dialog box is used to grab the
  //name of any user defined gesture
  bool Drawing(bool val);

  void LearningMode();

  //call this to add a point to the mouse path
  void AddPoint(POINTS p)
  void SaveNet();
  void Load();


here're save and load:
void CController::SaveNet()
   int count=0;
   vector<SNeuronLayer> netdata = m_pNet->GetNeurons();
   ofstream fout("brain.txt");
   for(int l=0; l<netdata.size(); l++)
     for(int n=0; n<netdata[l].m_vecNeurons.size(); n++)
       for(int w=0; w<netdata[l].m_vecNeurons[n].m_vecWeight.size(); w++)
         fout<<netdata[l].m_vecNeurons[n].m_vecWeight[w]<<" ";

void CController::Load()
 m_Mode = TRAINING;
 m_Mode = ACTIVE;

and I get these errors: 18 C:\Dev-Cpp\Examples\height2\NeHe.cpp from NeHe.cpp C:\Dev-Cpp\include\c++\3.4.2\bits\fstream.tcc In member function `virtual typename std::basic_filebuf<_CharT, _Traits>::int_type std::basic_filebuf<_CharT, _Traits>::underflow()': 277 C:\Dev-Cpp\include\c++\3.4.2\bits\fstream.tcc expected unqualified-id before '(' token ????? What is that?? But if I include the controller after the CMenu:
#ifndef  CMENU_H
#define  CMENU_H

#include <iostream>
#include <stdlib.h>
#include <windows.h>		// Header File For Windows
#include <stdio.h>			// Header File For Standard Input/Output
#include <gl\gl.h>			// Header File For The OpenGL32 Library
#include <gl\glu.h>			// Header File For The GLu32 Library
#include <string.h>
#include <stdarg.h>
#include <vector>

#include "Vector2D.h"
#include "NeHe.h"

#include "text.h"
#include "ortho.h"

using namespace std;

enum   GameState{MainMenu, Playing};
struct SButton{
 SButton(  float h, float w, Vector2D pos, GLint t);
 Vector2D  m_vPosition;
 GLint     tex_id;
 float     hight, width;
 bool      IsPressed();
 void      Render();
class  CMenu{
   //Holds the different states the game can be in 
    GameState m_GameStates;
    vector<SButton> m_vButtons;
    //updates the game menu
    void Update();
    //renders the menu
    void Render();
    //sees if something was pressed
    void ProcessMouse();
//---------------accessor methods
   GameState GetState(){return m_GameStates;}

extern CMenu Menu;

then I get this error: 26 C:\Dev-Cpp\Examples\height2\CMenu.h `Vector2D' has not been declared When I run the controller in a seperate program I get no errors. What is going on here. I had two programs that worked perfectly but when I combine them I get errors? Thanks.

Share this post

Link to post
Share on other sites
277 C:\Dev-Cpp\include\c++\3.4.2\bits\fstream.tcc expected unqualified-id before '(' token
You'll probably find that there is a name clash of some kind with the name used just before the '('. Probably a macro with the same name but a different meaning.

Share this post

Link to post
Share on other sites

This topic is 4202 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this