hey I'm trying to run this program on netbeans on Ubuntu

#include <windows.h>
#include <GL/gl.h>
#include <GL/glext.h>
#include <GL/glu.h>
#include <GL/glut.h>
void myInit(void)
 {
    glClearColor(1.0,0.0,0.0,0.0);       
    glColor3f(0.0f, 0.0f, 1.0f);          
    glPointSize(9.0);            
    glMatrixMode(GL_PROJECTION); 
    glLoadIdentity();
    gluOrtho2D(0.0, 640.0, 0.0, 480.0);
}
//<<<<<<<<<<<<<<<<<<<<<<<< myDisplay >>>>>>>>>>>>>>>>>
void myDisplay(void)
{
    glClear(GL_COLOR_BUFFER_BIT); 
    glBegin(GL_POINTS);
        glVertex2i(400, 350);         
        glVertex2i(100, 130);
        glVertex2i(150, 130);
    glEnd();    
    glFlush();                       
}

//<<<<<<<<<<<<<<<<<<<<<<<< main >>>>>>>>>>>>>>>>>>>>>>
void main(int argc, char** argv)
{
    glutInit(&argc, argv);        
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); 
    glutInitWindowSize(640,480);    
    glutInitWindowPosition(300, 0); 
    glutCreateWindow("my first attempt");
    glutDisplayFunc(myDisplay);   
    myInit();                   
    glutMainLoop();             
}

the problem is that this program runs perfectly on windows but on Linux it doesn't and I think the problem is in <windows.h> so is there an equivalent library that will make this program work?? and is there any other libraries required to run this on linux. oh and btw I've installed all the opengl libraries .

>this program runs perfectly

I doubt that: main returns int.

Remove <windows.h> as it's windows specific.

The required libraries are glut, gl and glu, although you may not need all three with that code. I don't know about using netbeans for c++ so I can't advise you on how to use it to link against those libs but if you:

g++ main.cpp -I/usr/X11R6/lib -lglut -lGL -lGLU -Wall -o firstglut

from the command line, where main.cpp contains the code you posted (corrected as previously mentioned) and /usr/X11R6/lib is replaced with your distribution specific path to your opengl libs directory, it should build and run fine.

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.