2
votes

I am trying to compile a program using GLFW as static library. I am sure that I have linked everything properly, because other GLFW functions do not throw any error. These are only functions using GLFWwindow* as a parameter. For example:

glfwMakeContextCurrent(window); //window is a pointer of type GLFWwindow

Error: Invalid arguments ' Candidates are: void glfwMakeContextCurrent(*)'

This throws me an error. The argument window is invalid. Other functions which expect a pointer to a GLFWwindow also throw errors. But the rest, functions without GLFWwindow* as expected argument compile and work just fine.

I am using MinGW32, Eclipse CDT, Win7. (I am sure that I use the 32bit GLFW)

What could be the reason, why he is not accepting my pointer?

P.S.: eclipse compiles glfwMakeContextCurrent(0); and as hint when I hover the line with the error it shows me glfwMakeContextCurrent(*); <- no type, just an asterisk

2
Have you actually tried to compile your code? This looks like a message from Eclipse, not compiler. - catscradle
Turned out, that linking the static library throwed some undefined references (They were shown after I removed the GLEW link). Now I am using the dll version of glfw without any errors. mingw/g++ is not complaining about anything, either. But the error "invalid arguments" still exists... Maybe this is a bug of Eclipse. I will try to run a program with this "error" and post again later... - Frischer Hering

2 Answers

0
votes

The function glfwWindowMakeContextCurrent does not exist in glfw. Depending on how you set up your compiler, it might assume that it exists and by default assumes that it takes integer arguments, so it might fail due to such a type mismatch. However, you probably are looking for the glfwMakeContextCurrent function, which indeed uses a GLFWwindow* argument.

0
votes

Problem solved... more or less. Using the static version of GLFW threw out some linking errors, so I am using the dll version now. I made a test program using this code and it worked just fine. But the errors are still shown by Eclipse. It seems that Eclipse can't read or find out the function properly.

Invalid arguments '
Candidates are:
void glfwMakeContextCurrent(*)
'

Need to find out how to make Eclipse ignore those lines with GLFWwindow* as argument...