JoeyDeVries / LearnOpenGL

Code repository of all OpenGL chapters from the book and its accompanying website https://learnopengl.com
https://learnopengl.com
Other
11.1k stars 2.81k forks source link

A cmake error and some compile errors (win 7, visual studio 2010) #32

Open ltt-gddxz opened 8 years ago

ltt-gddxz commented 8 years ago

Dear sir, After I downloaded the source code, I found there is no file naming text_rendering, while will cause some cmake errors. So I commented in the CMakeLists.txt the line 115: 2.text_rendering and successfully cmake the code. So I continue to run the sln file in the visual studio 2010, but there appeared many errors as follows:

3 > G: \ \ Program \ LearnOpenGL \ LearnOpenGL - master \ includes \ LearnOpenGL/filesystem h (23) : error C2601: "givenRoot" : local function definition is illegal 3 > G: \ \ Program \ LearnOpenGL \ LearnOpenGL - master \ includes \ LearnOpenGL/filesystem h (23) : error C2143: syntax errors: lack of ";"(in front of the "} ") 3 > G: \ \ Program \ LearnOpenGL \ LearnOpenGL - master \ includes \ LearnOpenGL/filesystem h (24) : error C2470: "root", looks like a function definition, but there is no parameter list;Skip the function body 3 > G: \ \ Program \ LearnOpenGL \ LearnOpenGL - master \ includes \ LearnOpenGL/filesystem h (25) : error C2065: "root", not statement of identifiers 3 >..\ SRC \ 5. Advanced_lighting \ 8. Deferred_shading \ deferred_shading CPP (107) : warning C4244: "initialization" : from the "double" to "GLfloat", may be loss of data 3 >..\ SRC \ 5. Advanced_lighting \ 8. Deferred_shading \ deferred_shading CPP (108) : warning C4244: "initialization" : from the "double" to "GLfloat", may be loss of data

I have no idea how to make it, forgive me for my poor English...

JoeyDeVries commented 8 years ago

I've fixed the text_rendering issue (it appears I forgot to push the actual code file of that tutorial).

As for your errors; it looks there's a misplaced bracket ( { or } ) somewhere in the code. It's not in the default source files so did you perhaps make some changes to the header code (or forgot to close a bracket in your own code?)

ltt-gddxz commented 8 years ago

Thanks for your prompt reply, but when I search for the first error in the file "filesystem.h", I find the following code:

image

It seems that it is trying to define functions in function getRoot() , which is illegal as the compiler shows.

JoeyDeVries commented 8 years ago

It seems your compiler doesn't support C++'s variable list initialization (I'm not sure what it's called); it's not actually defining a function, it's setting the variable values w/ brackets. I've removed the initialization, this should hopefully fix your issue.

ltt-gddxz commented 8 years ago

Ok, thanks.