Hello! I have problem with class, the error is "Applik" : is not a class or namespace name.
In mine opinion code is fine, and i cannot find solution, please help me i am beginner.
This is mine code

**App.h **

#pragma once
#include <SDL/SDL.h>
#include <windows.h>
#include <gl\gl.h>
#include <gl\glu.h>
#include <gl\glaux.h>
#include <GL\glext.h>
#include <GL\glui.h>
#include <GL\glut.h>
#define App_h[/COLOR]

class Applik
{
public:
    Applik(void);
    ~Applik(void);
    explicit Applik(size_t win_width, size_t win_height, bool fullscreen_mode)
        : m_window_width(win_width), m_window_height(win_height), m_fullscreen(fullscreen_mode) 
    {
    }
    void Run();

private:
    void Draw();
    void Update(double dt);
    void Resize(size_t szerokosc, size_t wysokosc);
    void ProcessEvents();

private:
    size_t m_window_width;
    size_t m_window_height;
    bool m_fullscreen;
    bool is_done;
    SDL_Surface* m_screen;

};

App.cpp

#include "App.h"
#include <assert.h>
#include "StdAfx.h"
#include <cassert>
#define App_h

using namespace std;


Applik::Applik(void)
{
}


Applik::~Applik(void)
{
}

void Applik::Run()
{ 
    SDL_Init(SDL_INIT_VIDEO);
    Resize (m_window_width, m_window_height);
    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); 


    glClearDepth(1);
    glClearColor(0, 0, 0, 0);
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LEQUAL);


  is_done = false;
  size_t last_ticks = SDL_GetTicks();
  while (!is_done)
  {
      ProcessEvents();
      // time update
      size_t ticks = SDL_GetTicks();
      double czas_delty = (ticks - last_ticks) / 1000.0;
      last_ticks = ticks;

      // update i render
      if (czas_delty > 0)
      {
          Update(czas_delty);
      }
      Draw();
  }

  SDL_Quit();
}

void Applik::Draw() {
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glLoadIdentity();
  glBegin(GL_TRIANGLES);
  {
      glColor3f(1, 1, 0); 
      glVertex2f(1, 1);
      glVertex2f(0, 1);
      glVertex2f(0, 0);

  }
  glEnd();
  SDL_GL_SwapBuffers();
}

main.cpp

#include <windows.h>
#include <assert.h>
#include "stdafx.h"
#include <iostream>
#include <conio.h>
#include "App.h"


//int _tmain(int argc, _TCHAR* argv[])
int main(int argc, char *argv[])
{
    Applik app(600, 400, false);
    app.Run();
    return 0;
}

Btw im using ms visual 2010 please help :)

Recommended Answers

All 3 Replies

Applik(void);
~Applik(void);

Did you realy need void in function? I don't think so.
Are you beginner and using OpenGL, class even process?
I'm just watching ;)

Please use Code tag, when posting the code. otherwise the formatting won't be preserved, making it difficult to read it...

Please use Code tag.

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.