User forums > Help

How do you fully install opengl???

<< < (3/3)

crinkle:

--- Quote from: oBFusCATed ---You cannot have full path there, just the name of the file (strip the extension and lib prefix).
--- End quote ---
ok I tried just typing in "glut" there, but then it said it couldnt find "-lglut" in the error message. BUT that was the only error message.

I put in glut32 (the actual filename without directory or file extension in it) and it gave the errors.

From the above, if it REALLY couldnt find the file, it would just give the first "cannot find" error message. But it doesnt, it says that lots of commands are unknown but it MUST be finding the file, as it doesnt give the first error message. Should I redownload glut (link please)? did i get a bad version?



--- Quote from: oBFusCATed ---The path must go in search directories -> linker!
--- End quote ---

I have absolutely no idea what you are talking about here, please explain more.

Vuki:
You're trying to link with libglut32.lib which is a Visual Studio import library. You're using MinGW. Linking to lib files from gcc sometimes works, sometimes not, depending on the library type. In your case, symbol names in the file seem to be different than the compiler expects. You should link to libglut32.a or a similar lib*.a file. There are tools that convert import libraries.

The easiest solution in your case: download freeglut library (a free GLUT replacement). There are precompiled MinGW binaries linked on the project page, you can also compile the library yourself. Then link your code to freeglut (libfreeglut.a) and it should work.

And your problem is not CodeBlocks related.

oBFusCATed:
MinGW/TDM releases are capable to link directly to DLL, there is no need for an import libraries.

crinkle:
Ok so i downloaded and installed freeglut, no problem, it ran the default code with the spinny red objects, great stuff.... then when trying to use the other code, it wouldnt work:

(this is the very first example code from here: http://en.wikibooks.org/wiki/OpenGL_Programming/Modern_OpenGL_Introduction)


--- Code: ---/* Using the standard output for fprintf */
#include <stdio.h>
#include <stdlib.h>
/* Use glew.h instead of gl.h to get all the GL prototypes declared */
#include <glew.h>
/* Using the GLUT library for the base windowing setup */
#include <glut.h>
/* ADD GLOBAL VARIABLES HERE LATER */

int init_resources(void)
{
  /* FILLED IN LATER */
  return 1;
}

void onDisplay()
{
  /* FILLED IN LATER */
}

void free_resources()
{
  /* FILLED IN LATER */
}

int main(int argc, char* argv[])
{
  /* Glut-related initialising functions */
  glutInit(&argc, argv);
  glutInitContextVersion(2,0);
  glutInitDisplayMode(GLUT_RGBA|GLUT_DOUBLE|GLUT_DEPTH);
  glutInitWindowSize(640, 480);
  glutCreateWindow("My First Triangle");

  /* Extension wrangler initialising */
  GLenum glew_status = glewInit();
  if (glew_status != GLEW_OK)
  {
    fprintf(stderr, "Error: %s\n", glewGetErrorString(glew_status));
    return EXIT_FAILURE;
  }

  /* When all init functions run without errors,
  the program can initialise the resources */
  if (1 == init_resources())
  {
    /* We can display it if everything goes OK */
    glutDisplayFunc(onDisplay);
    glutMainLoop();
  }

  /* If the program exits in the usual way,
  free resources and exit with a success */
  free_resources();
  return EXIT_SUCCESS;
}

--- End code ---

It gives an error:

mingw32-g++.exe -Wall -g -I"C:\Program Files (x86)\CodeBlocks\MinGW\include" -c "C:\Users\Beasty\Desktop\CODE BLOCKS\Tutorials\Yoolloooo\main.cpp" -o obj\Debug\main.o
C:\Users\Beasty\Desktop\CODE BLOCKS\Tutorials\Yoolloooo\main.cpp: In function 'int main(int, char**)':
C:\Users\Beasty\Desktop\CODE BLOCKS\Tutorials\Yoolloooo\main.cpp:30:29: error: 'glutInitContextVersion' was not declared in this scope

What's this mean and how can it be fixed?

crinkle:
I also now have another query in relation to this website:

http://en.wikibooks.org/wiki/OpenGL_Programming#The_basics_arc

From an example page i found a link to the source code for the examples and decided to download it. I was sure that if ever anything was ever even remotely possible to fluke and work, it would be with fully working examples which had been set up by an expert that I could just open and run.

FYI, the download link page is here: https://gitorious.org/wikibooks-opengl/modern-tutorials/source/90bf72991caf34ea6cdbed044a9616b7bbdf2d0f:

Unfortunately (as expected), they did not work, none of them, from the simplest code to the more complex stuff, compile errors everywhere (usually starting with "___IMP___" for some reason), Here's the build log for tut01_intro\triangle.cpp:


--- Code: ---...\tut01_intro\triangle.o:triangle.cpp:(.text+0x1c): undefined reference to `_imp____glutInitWithExit@12'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x3e): undefined reference to `_imp____glutCreateWindowWithExit@8'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x60): undefined reference to `_imp____glutCreateMenuWithExit@8'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0xb1): undefined reference to `_imp____glewCreateShader'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0xd5): undefined reference to `_imp____glewShaderSource'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0xfe): undefined reference to `_imp____glewCompileShader'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x110): undefined reference to `_imp____glewGetShaderiv'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x16a): undefined reference to `_imp____glewCreateShader'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x18e): undefined reference to `_imp____glewShaderSource'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x1b7): undefined reference to `_imp____glewCompileShader'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x1c9): undefined reference to `_imp____glewGetShaderiv'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x223): undefined reference to `_imp____glewCreateProgram'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x238): undefined reference to `_imp____glewAttachShader'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x253): undefined reference to `_imp____glewAttachShader'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x26e): undefined reference to `_imp____glewLinkProgram'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x282): undefined reference to `_imp____glewGetProgramiv'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x2e2): undefined reference to `_imp____glewGetAttribLocation'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x3d0): undefined reference to `glClearColor@16'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x3df): undefined reference to `glClear@4'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x3e7): undefined reference to `_imp____glewUseProgram'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x3fb): undefined reference to `_imp____glewEnableVertexAttribArray'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x424): undefined reference to `_imp____glewVertexAttribPointer'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x476): undefined reference to `glDrawArrays@12'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x47e): undefined reference to `_imp____glewDisableVertexAttribArray'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x492): undefined reference to `_imp__glutSwapBuffers@0'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x4c9): undefined reference to `_imp____glewDeleteProgram'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x519): undefined reference to `_imp__glutInitContextVersion@8'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x52a): undefined reference to `_imp__glutInitDisplayMode@4'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x543): undefined reference to `_imp__glutInitWindowSize@8'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x55c): undefined reference to `_imp__glewInit@0'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x572): undefined reference to `_imp__glewGetErrorString@4'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x5b4): undefined reference to `_imp__glutDisplayFunc@4'
...\tut01_intro\triangle.o:triangle.cpp:(.text+0x5be): undefined reference to `_imp__glutMainLoop@0'
--- End code ---

glut (freeglut is installed), glew is installed, GLM is installed now as well. What else needs to be installed?

For the record I have not edited the code at all. I literally just opened codeblocks, opened the .cpp file and ran it. No adjustments.

Can anyone confirm that any of the code from the above site works at all? I'm starting to think its actually not me now...

If anyone can make any of this code run, please advise what else is needed to be installed in codeblocks...

Navigation

[0] Message Index

[*] Previous page

Go to full version