hello again,
just tried to compile my project and i'm getting errors with a file cstdlib

Error 2 error C2039: 'abort' : is not a member of '`global namespace'' c:\program files\microsoft visual studio 9.0\vc\include\cstdlib 23
Error 3 error C2873: 'abort' : symbol cannot be used in a using-declaration c:\program files\microsoft visual studio 9.0\vc\include\cstdlib 23
Error 4 error C2039: 'exit' : is not a member of '`global namespace'' c:\program files\microsoft visual studio 9.0\vc\include\cstdlib 26
Error 5 error C2873: 'exit' : symbol cannot be used in a using-declaration c:\program files\microsoft visual studio 9.0\vc\include\cstdlib 26

i have no idea whats causing these errors so far as i'm aware i'm not even using cstdlib

-Midi

try

#include <iostream>

//...or

using namespace std;

//...

all the files that seem to give me the cstdlib error have that in them already

-midi

post header files...please...

Of more relevance, try posting a small sample of your code that illustrates the problem. Also provide information about your compiler settings (eg any settings you've tweaked in the VC IDE to non-standard settings).

My guess is that you've been playing with some #define's somewhere (either before you've include'd some headers, or in the IDE settings) and they interact with the headers in strange ways.

the only thing i've done is add

GLUT_BUILDING_LIB to the preprocessors to stop a clash between glut and stdlib

i have no idea what code to post, my program consists of 30 files and the error says its in the file cstdlib the only thing i have to go on is the errors happen after these 3 files

test.cpp

#include <iostream>

using namespace std;

#include "vrobject.h"


int main(int argc, char **argv){

  Viewer *myViewer=new Viewer;
  myViewer->Init(argc,argv);
  myViewer->InitWorld();
  myViewer->SetValue(BUFFER,MDOUBLE);
  myViewer->CreateWin("Test",1280,720);
  myViewer->InitCamera();
  myViewer->Show();

  return 0;
}

viewer.cpp

#include "viewer.h"

using namespace std;

Viewer::Viewer(){
  
  
  WinName="";
  BufType=GLUT_SINGLE;
  
  for(int i=0;i<3;i++){
    background[i]=0.0f;
  }

}

Viewer::~Viewer(){
  return;
}

void Viewer::Init(int argc,char **argv){

  eye[0]=0.0f;
  eye[1]=0.5;
  eye[2]=25.0;

  aim[0]=0.0f;
  aim[1]=0.0f;
  aim[2]=0.0f;

  upright[0]=0.0f;
  upright[1]=1.0f;
  upright[2]=0.0f;
    
  glutInit(&argc,argv);
 
}

void Viewer::CreateWin(char *Name,int Width,int Height){
  WinName=Name;
  WinWidth=Width;
  WinHeight=Height;
}

void Viewer::SetValue(myEnum PName,myEnum Type){

  switch(PName){
  case BUFFER:
    if(Type==MDOUBLE)
      BufType=GLUT_DOUBLE;
    else
      if(Type==SINGLE)
        BufType=GLUT_SINGLE;
    break;
  case BACKCOLOUR:
    break;
  default:
    break;
  }
}


void Viewer::InitWorld(){
  vrman=new WorldManager;
  vrman->initialise();
 
}
void Viewer::InitCamera(){
  mycamera=new camera(PERSPECTIVE);
  mycamera->SetValue(MNEAR,1.0f);
  mycamera->SetValue(YANGLE,45.0f);


  mycamera->SetValuev(AIMAT, aim);
  mycamera->SetValuev(UPDIRECTION, upright);
  mycamera->SetValuev(POSITION, eye);
  
  mycamera->SetValue(MFAR,500.0f);
  mycamera->SetValue(HEIGHT,WinHeight);
  mycamera->SetValue(ASPECT,1.0f);
}

void Viewer::SetCamera(float nvalue,float viewangle){
  mycamera->SetValue(MNEAR, nvalue);
  mycamera->SetValue(YANGLE, viewangle);

}

void Viewer::Show(){
  
  GLInit();
  glutMainLoop();

}


void Viewer::GLInit(){
  glutInitDisplayMode(BufType |GLUT_RGB |GLUT_DEPTH);
  glutInitWindowSize(WinWidth, WinHeight);
  glutCreateWindow(WinName);
  glutReshapeFunc(Reshape);
  glutDisplayFunc(Display);
  glutMouseFunc(Mouse);
  glutIdleFunc(Idle);
  glutKeyboardFunc(Keyboard);
  glutSpecialFunc(SpecialKey); 
  glEnable(GL_DEPTH_TEST);
  glClearColor(0.0f,0.0f,0.0f,1.0f);

}


void Viewer::Display(){
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  vrman->exec_loop();
  
 
  glFlush();
  if(BufType==GLUT_DOUBLE){

    glutSwapBuffers();
  }
  

}

void Viewer::Reshape(int w,int h){

  glViewport(0,0,(GLsizei)w,(GLsizei)h);
  WinWidth=w;
  WinHeight=h;
  mycamera->SetValuev(POSITION,eye);
  mycamera->SetValuev(AIMAT,aim);
  mycamera->Render();
 
}

void Viewer::Mouse(int button,int state,int x,int y){

  vrman->mouse(button,state,x,y);
  Display();
}

void Viewer::Idle(){
  vrman->idle();
  Display();
}

void Viewer::Keyboard(unsigned char key,int x,int y){

  switch(key){
  case 0x14b:
  case 38://up
    eye[2]-=0.5;
    aim[2]-=0.5;
    break;
  case 40: //down arrow
    eye[2]+=0.5;
    aim[2]+=0.5;
    break;
  case 37://left
    eye[0]-=0.5;
    aim[0]-=0.5;
    break;
  case 39://right arrow
    eye[0]+=0.5;
    aim[0]+=0.5;
    break;
  default:
     vrman->keyboard((unsigned char)key,x,y);
     break;
  }
  
  Display();
}

void Viewer::SpecialKey(int key, int x, int y){
 switch(key){
 case GLUT_KEY_F1:
      upright[0]=0.0f;
      upright[1]=0.0f;
      upright[2]=-1.0f;
      aim[0]=0.0f;
      aim[1]=0.0f;
      aim[2]=0.0f;
      eye[0]=0.0f;
      eye[1]=25.0f;
      eye[2]=0.0f;
      break;
 case GLUT_KEY_F2:
      upright[0]=0.0f;
      upright[1]=1.0f;
      upright[2]=0.0f;
      aim[0]=0.0f;
      aim[1]=0.0f;
      aim[2]=0.0f;
      eye[0]=0.0f;
      eye[1]=0.5f;
      eye[2]=25.0f;
      break;
  case GLUT_KEY_F12:
    vrman->restart();
    break;
  case GLUT_KEY_UP:
    eye[2]-=0.5;
    aim[2]-=0.5;
    break;
  case GLUT_KEY_DOWN:
    eye[2]+=0.5;
    aim[2]+=0.5;
    break;
  case GLUT_KEY_LEFT:
    eye[0]-=0.5;
    aim[0]-=0.5;
    break;
  case GLUT_KEY_RIGHT:
    eye[0]+=0.5;
    aim[0]+=0.5;
    break;
 case GLUT_KEY_PAGE_UP:
   eye[1]+=0.5;
   aim[1]+=0.5;
   break;
 case GLUT_KEY_PAGE_DOWN:
   eye[1]-=0.5;
   aim[1]-=0.5;
   break;
  default:
     vrman->keyboard((unsigned char)key,x,y);
     break;
  }
 mycamera->SetValuev(UPDIRECTION,upright);
 mycamera->SetValuev(POSITION,eye);
 mycamera->SetValuev(AIMAT,aim);
 mycamera->Render();
 Display();
}

worldmanager.cpp

#include "worldmanager.h"

using namespace std;

void WorldManager::initialise(){
  myscene=new Scene;
  myscene->initialise();
   return;
}

void WorldManager::restart(){
 

}

void WorldManager::exec_loop(){
  //exectuion loop.
  render();
}

void WorldManager::render(){

  //  Draw a scene
  myscene->render();
}

void WorldManager::keyboard(unsigned char key,int x,int y)
{
	myscene->keyboard(key,x,y);
}

void WorldManager::mouse(int button, int state, int x,int y){
  return;
}

void WorldManager::idle(){
  return;
}

i'm thinking it could be a corrupt header file but i cant seem to find stdlib anywhere atleast not one that looks anything like what i have at the moment

-midi

I'd look in the glut header files before looking in the cstdlib. The fact there is even a macro GLUT_BUILDING_LIB to define to "stop a clash between glut and stdlib" says that the incompatibility is the glut header file and library, rather than the standard library.

Generally, suppliers of third-party libraries (like glut) are responsible for ensuring compatibility with compilers and standard libraries. Presumably, in your case, the glut library people have not ensured compatibility with your version of Visual Studio.

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.