Menu

[Build Error] [main.o] Error 1

Anonymous
2011-09-27
2012-09-26
  • Anonymous

    Anonymous - 2011-09-27

    I've an error when try this code. i've installed DeVC++ 4.9.9.2 with Glut
    installed. how to solve it?
    here's the code..

    include <GL glut.h="">

    const int A = 500; / length of a side of the monitor window /
    const float B = 500; / length of a side of the clipping rectangle /
    const float C = 200; / length of a side of the square the program draws /

    void myinit(void)
    {
    glClearColor(0.7, 0.7, 0.7, 0.0); / gray background /

    glMatrixMode(GL_PROJECTION); / In World coordinates: /
    glLoadIdentity(); / position the "clipping rectangle" /
    gluOrtho2D( -B/2, B/2, -B/2, B/2);/ at -B/2, its right edge at +B/2, its
    bottom
    /
    glMatrixMode(GL_MODELVIEW); / edge at -B/2 and its top edge at +B/2 /
    }

    void display( void )
    {

    glClear(GL_COLOR_BUFFER_BIT); / clear the window /

    glMatrixMode(GL_MODELVIEW); / The following coordinates are expressed /
    glLoadIdentity(); / in terms of World coordinates /

    glBegin(GL_POLYGON) ; / draw a filled polygon /
    glColor3f ( 1.0, 0.3, 0.2); / draw in light red /
    glVertex2f( -C/2, -C/2 ); / (x,y) /
    glVertex2f( C/2, -C/2 ); / (x,y) /
    glVertex2f( C/2, C/2 ); / (x,y) /
    glVertex2f( -C/2, C/2 ); / (x,y) /
    glEnd();

    glFlush(); / send all commands /
    }

    void main(int argc, char argv)
    {
    glutInit(&argc,argv);
    glutInitWindowSize( A, A ); /
    A x A pixel screen window
    /

    glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE);
    glutCreateWindow("My Rectangle"); / window title /
    glutDisplayFunc(display); / tell OpenGL main loop what /
    myinit(); / set attributes /

    glutMainLoop(); / pass control to the main loop /

     
  • Jim Pattee

    Jim Pattee - 2011-09-27

    You need to post your compile log.
    I am assuming the missing brace at the end is an error in copying.

     
  • Anonymous

    Anonymous - 2011-09-27

    here's compiler log's

    Compiler: Default compiler
    Building Makefile: "C:\Dev-Cpp\Makefile.win"
    Executing make...
    make.exe -f "C:\Dev-Cpp\Makefile.win" all
    g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include"
    -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-
    Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-
    Cpp/include"

    g++.exe: main.cpp: No such file or directory
    g++.exe: no input files

    make.exe: *** Error 1

     
  • Jim Pattee

    Jim Pattee - 2011-09-28

    It is compiling from a makefile instead of a project.
    Have you created a dev-cpp project that contains main.cpp?
    The project must also contain paths to the glut header and library files.

     
  • Anonymous

    Anonymous - 2011-09-28

    I've created an dev-cpp project that contains main.cpp files and was already
    including path for glut header and library.

    include <windows.h>

    include <gl gl.h="">




     
  • Jim Pattee

    Jim Pattee - 2011-09-28

    You must create a project FILE that contains information about how to compile
    the project.
    Look thru the menus to determine how to do it.
    The glut path must be included in the project file, not in the source code.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.