So I have stumbled across another problem. This time I'm using freeglut I have put the lib files, dll, and include files where they should go in visual studio. Made a project and linked the lib files in it but i still cant initialize glut using glutInit. Here's what I got so far:

#include <GL/glew.h>
#include <GL/glut.h>

int main (int argc, char **argv) {
}

glutInit(&argc,argv);

glutInit says: This declaration has no storage class or type specifier
argc says: identifier argc is undefined

If anyone could point me out in the right direction that would be great as I have stumbled across problems the whole day and I would like at least make a window today.

Recommended Answers

All 5 Replies

it might be because glutInit is outside of main?
(if that's how your actual code looks)

Im guessing something wrong with the header file where it is defined? I just copy pasted the ones that comes with freeglut to the include/GL folder so got no idea what could be wrong other than a corrupted file in there maybe.. going to try another download and replace them.

thx for your reply gonna try that now im just starting out with this so lets give it a shot :)

OMG perfect thanks so much!! weird thing is that the guid im following puts it outside weirdd hehe better change guide hehe thanks again.

putting it outside of main() means that it isn't called when the program is run.
and I think the errors happened because the function uses argc and argv which are not in the global scope (they can only be used inside main())

well thats my guess anyway :)

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.