1

Here's the problem: when compiling, it gives an error "invalid conversion from 'int' to 'int*' [-fpermissive]" on the line 3 of this example code.

Originally, I didn't have the code as I do now, what I had it as caused errors, and gave me a recommendation, "try ____", which got me to where I am now. I've searched for the error it gave me (invalid conversion from...) and none of the pages I'd seen had actually had a fix for the example I have, so I look up my error with extra search terms like "opengl" and "glut", which gave one result that had a fix, the only problem is, the compiler still gave an error.

Here is an example of the code, shortened down to show only what is causing the problem

#include<windows.h>
#include<GL/glut.h>
main(){
    glutInit(_argc,_argv);
}
qrani
  • 67
  • 6

1 Answers1

1

The error says it all: you provide an int (integer) where int* (pointer to integer) is expected. In this case -- that you minimized well -- it is the first parameter to glutInit().

This function handles some of the arguments and wants to change their number in the course. Therefore you must hand over its pointer:

glutInit(&_argc,_argv);
the busybee
  • 10,755
  • 3
  • 13
  • 30
  • thanks for the help, but when I do that and compile the program it gives three errors, `undefined reference to '__glutInitWithExit@12'`, `undifined reference to '__glutCreatWindowWithExit@8'`, and `undifined reference to '__glutCreatMenuWithExit@8'` – qrani Aug 20 '19 at 16:12
  • 1
    [About undefined reference](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – Ripi2 Aug 20 '19 at 16:44
  • Well, qrani, this is another question which can be answered for example by reading the case @Ripi2 pointed to. Kudos to him! You will also get a lot of help if you ask your favorite search engine about "how to link with glut". – the busybee Aug 20 '19 at 19:13