It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
Hi guys! I am working on an OpenGL project and I kind of need your help.
I have an error in the code and I am not sure where I have it from.
I know it says that there is some problem on the int main () about a braket, but I tried to "fix" it and I didn't succeded.
There is the code: http://pastebin.com/c9kxNndt
I did it in Visual C++ 2010 Express.
I am not sure if I am allowed to post that here but not sure where to ask help anymore :P
This question / problem has been solved by Shinookimage
avatar
robb5: Hi guys! I am working on an OpenGL project and I kind of need your help.
I have an error in the code and I am not sure where I have it from.
I know it says that there is some problem on the int main () about a braket, but I tried to "fix" it and I didn't succeded.
There is the code: http://pastebin.com/c9kxNndt
I did it in Visual C++ 2010 Express.
I am not sure if I am allowed to post that here but not sure where to ask help anymore :P
I not a C++ programer but just a wild guess, shouldn't there be a } for every { ? Because you have an extra one, check lines 11-17. Or maybe you are missing one.
Post edited August 01, 2013 by FreedomWings
avatar
robb5: Hi guys! I am working on an OpenGL project and I kind of need your help.
I have an error in the code and I am not sure where I have it from.
I know it says that there is some problem on the int main () about a braket, but I tried to "fix" it and I didn't succeded.
There is the code: http://pastebin.com/c9kxNndt
I did it in Visual C++ 2010 Express.
I am not sure if I am allowed to post that here but not sure where to ask help anymore :P
avatar
FreedomWings: I not a C++ programer but just a wild guess, shouldn't there be a } for every { ? Because you have an extra one, check lines 11-17. Or maybe you are missing one.
Well I tried earlier to remove the { from int main but then it gives me a lot of errors about the header files and main function, then I tried to add } at the ending but it gives me other errors.
You need to terminate the bracket opened with main(), add a } on line 46.
If I try to remove the } here are the error messages:
http://pastebin.com/UdGEqDTM
And if I try to add one at the end:
http://pastebin.com/wMX6Ase4
avatar
Shinook: You need to terminate the bracket opened with main(), add a } on line 46.
I tried it but it gives me this message:
1>------ Build started: Project: THE GOOD STUFF, Configuration: Debug Win32 ------
1> main.cpp
1>e:\visual c++\project\the good stuff\the good stuff\main.cpp(48): error C2059: syntax error : '}'
1>e:\visual c++\project\the good stuff\the good stuff\main.cpp(49): error C2059: syntax error : 'while'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Because if I put it at line 46 it blocks the effect of "do".
Post edited August 01, 2013 by robb5
avatar
robb5: And if I try to add one at the end:
http://pastebin.com/wMX6Ase4
Well that's ok :) You have to link with some libraries. I haven't programmed under windows for the last 10 years but if I remember right there should be some build settings where you can select the libraries with which you want to link.
Somewhere here: Configuration Properties, Linker, Input, Additional Dependencies: add your lib file to the list here.
Post edited August 01, 2013 by blotunga
avatar
robb5: And if I try to add one at the end:
http://pastebin.com/wMX6Ase4
avatar
blotunga: Well that's ok :) You have to link with some libraries. I haven't programmed under windows for the last 10 years but if I remember right there should be some build settings where you can select the libraries with which you want to link
The thing is that I already linked with those libraries:
glew
glfw
glm
And I am not sure what other's I should use XD
avatar
robb5: If I try to remove the } here are the error messages:
http://pastebin.com/UdGEqDTM
And if I try to add one at the end:
http://pastebin.com/wMX6Ase4
avatar
Shinook: You need to terminate the bracket opened with main(), add a } on line 46.
avatar
robb5: I tried it but it gives me this message:
1>------ Build started: Project: THE GOOD STUFF, Configuration: Debug Win32 ------
1> main.cpp
1>e:\visual c++\project\the good stuff\the good stuff\main.cpp(48): error C2059: syntax error : '}'
1>e:\visual c++\project\the good stuff\the good stuff\main.cpp(49): error C2059: syntax error : 'while'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Because if I put it at line 46 it blocks the effect of "do".
Oops, not line 46. Sorry, I'm a style nazi and removed a bunch of your comments, but forgot that I did it, which changed my line numbers.

Try line 50 or later (at the very end of your code).
avatar
robb5: If I try to remove the } here are the error messages:
http://pastebin.com/UdGEqDTM
And if I try to add one at the end:
http://pastebin.com/wMX6Ase4

I tried it but it gives me this message:
1>------ Build started: Project: THE GOOD STUFF, Configuration: Debug Win32 ------
1> main.cpp
1>e:\visual c++\project\the good stuff\the good stuff\main.cpp(48): error C2059: syntax error : '}'
1>e:\visual c++\project\the good stuff\the good stuff\main.cpp(49): error C2059: syntax error : 'while'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Because if I put it at line 46 it blocks the effect of "do".
avatar
Shinook: Oops, not line 46. Sorry, I'm a style nazi and removed a bunch of your comments, but forgot that I did it, which changed my line numbers.

Try line 50 or later (at the very end of your code).
Wait! I think I have discovered something XD one moment and I will be back with a feedback
Perfect...now it gives me the error that it can't find glew.h, but i already included it in both the settings and the SDK folder...
Post edited August 01, 2013 by robb5
avatar
Shinook: Try line 50 or later (at the very end of your code).
Yup, main is not closed
avatar
robb5: Wait! I think I have discovered something XD one moment and I will be back with a feedback
Perfect...now it gives me the error that it can't find glew.h, but i already included it in both the settings and the SDK folder...
http://www.glfw.org/faq.html#32__why_do_i_get_link_errors_when_trying_to_build_my_program
Google is your best friend :)
avatar
Shinook: Try line 50 or later (at the very end of your code).
avatar
Fenixp: Yup, main is not closed
Well I tried closing it at the end but now it says it can't open file 'glew.h', not sure why since I already included it...
avatar
blotunga: Well that's ok :) You have to link with some libraries. I haven't programmed under windows for the last 10 years but if I remember right there should be some build settings where you can select the libraries with which you want to link
avatar
robb5: The thing is that I already linked with those libraries:
glew
glfw
glm
And I am not sure what other's I should use XD
You didn't link against them, you included them. There is a difference.

When you #include a header file, you are including all of the types defined in that header file for compilation purposes. This doesn't actually include the code from the library into your binary, it only tells the compiler type information. For example, if you #include "foo.h" with the foobar() function declared, you'll get the declaration of foobar() for compilation, but you won't get the actual code of the foobar() function until the linking phase.

When you link against a library, the linker (which runs post compilation) 'links' the actual code from the library into your application. This takes the code from the library, which is going to be compiled prior to linking as well, and puts it into the application you are developing, then links it all together. This is an elementary description of the process, obviously.

You need to find the library and tell the VC++ linker where to find it so it can resolve those symbols. Note again that linking happens post compilation and has little to do with your #includes at that point.
Post edited August 01, 2013 by Shinook
avatar
robb5: Wait! I think I have discovered something XD one moment and I will be back with a feedback
Perfect...now it gives me the error that it can't find glew.h, but i already included it in both the settings and the SDK folder...
avatar
blotunga: http://www.glfw.org/faq.html#32__why_do_i_get_link_errors_when_trying_to_build_my_program
Google is your best friend :)
I found that earlier when I didn't had any glew errors XD
avatar
robb5: The thing is that I already linked with those libraries:
glew
glfw
glm
And I am not sure what other's I should use XD
avatar
Shinook: You didn't link against them, you included them. There is a difference.

When you #include a header file, you are including all of the types defined in that header file for compilation purposes. This doesn't actually include the code from the library into your binary, it only tells the compiler type information. For example, if you #include "foo.h" with the foobar() function declared, you'll get the declaration of foobar() for compilation, but you won't get the actual code of the foobar() function until the linking phase.

When you link against a library, the linker (which runs post compilation) 'links' the actual code from the library into your application. This takes the code from the library, which is going to be compiled prior to linking as well, and puts it into the application you are developing, then links it all together. This is an elementary description of the process, obviously.

You need to find the library and tell the VC++ linker where to find it so it can resolve those symbols. Note again that linking happens post compilation and has nothing to do with your #includes.
Well i did that too using the visual configuration, I added the libraries files, copied them in the subfolders of Microsoft SDK, then linked them using the Input submenu in the Visual Config.
Well since now I resolved the issue I started with I have to deal with the one when it can't open glew, I think I can deal with it myself thank you guys for help :)
Post edited August 01, 2013 by robb5
avatar
robb5: Well i did that too using the visual configuration, I added the libraries files, copied them in the subfolders of Microsoft SDK, then linked them using the Input submenu in the Visual Config.
Well since now I resolved the issue I started with I have to deal with the one when it can't open glew, I think I can deal with it myself thank you guys for help :)
You probably have to add the header to the include path.