News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Set up GLEW in CODE::BLOCKS

Started by searcher, July 29, 2012, 11:47:19 PM

Previous topic - Next topic

MortenMacFly

You'll need to fix the compiler and linker errors - these are no errors due to a wrong setup of the compiler.

Usually you are missing to setup the include path's for the compiler to find required header files and for the linker to find required libraries. Finally you'll need to link against the right libraries in the right order.

All these settings depend on what you have in mind and what framework you use, so I cannot help any more. We can't provide framework-related support in this forum, sorry. Read the documentation / developer guide of GLEW and setup you project/target options accordingly (notice: NOT the global compiler options!).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

searcher

@MortenMacFly:
I appreciate your reply, however, it appears to me that there is something very odd going on - most likely nothing to do with GLEW. In desperation I wiped out all previous projects and decided to make a totally fresh start. Downloaded fresh installation of CODE::BLOCKS and decided to run the "Hello World" example which comes with it.
(1) Program compiles perfectly.
(2) Hit Build&Run and get a mass of errors similar to those I started this post with.
I have built and run many, more complex, C++ programs with CB in the past and I'm completely stumped.

MortenMacFly

Quote from: searcher on August 30, 2012, 02:17:24 AM
(1) Program compiles perfectly.
(2) Hit Build&Run and get a mass of errors similar to those I started this post with.
I don't get it: Does it compile or not? The first bullet says yes, the second one says no.

Things like this:
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\crt2.o:crt1.c|| undefined reference to `SetUnhandledExceptionFilter@4'|

...are linker errors and you need to fix them. In this specific case you are missing to link against kernel32. For details, see here:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms680634%28v=vs.85%29.aspx and use google.

As I've said: Read the frameworks developer guide what dependencies you have. If in doubt, compile a simple example on the command line - then transfer the settings into the IDE. Most people in this forum don't know GLEW and this question is not related to Code::Blocks. So you won't find much helpful advise here - ask in a GLEW forum for the library dependencies.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

searcher

@MortenMacFly:
F.Y.I. on the BUILD dropdown there is an option "compile current file" which results in compilation without building or running !! Hence my bullet (1). Bullet (2) followed from using Build option AFTER the first option. I think you will find that explains my post.
I must also disagree that this is not related to Code::Blocks. However, it is clear that the problem relates to linking (that's what the Build instruction does) as you observe. I shall certainly consult the reference you supplied and thank you for your patience.

Jenna

Quote from: searcher on August 30, 2012, 07:30:22 PM
I must also disagree that this is not related to Code::Blocks. However, it is clear that the problem relates to linking ...
Why do you think it's related to Code::Blocks ?
C::B only does what you tell it to do, it uses the linking options you set up and links your files with the executable you have specified.

C::B is neither a linker, nor a compiler, it does not do any hidden magic, it's "just" an IDE, that generates the needed commands from your setup.

searcher

@jens:
The title of this section is "USING CODE::BLOCKS" , right? It seem painfully obvious to me that is what I am trying to do - without much success and very little in the way of concrete help. When a fresh download of CB will compile but not build/run the demo "Hello World" then I may be forgiven for thinking that something is amiss !
FYI the demo will compile and run from the cmd line and if you think I can't figure that out -you are correct.   

dmoore

Quote from: searcher on August 30, 2012, 10:39:29 PM
@jens:
The title of this section is "USING CODE::BLOCKS" , right? It seem painfully obvious to me that is what I am trying to do - without much success and very little in the way of concrete help. When a fresh download of CB will compile but not build/run the demo "Hello World" then I may be forgiven for thinking that something is amiss !
FYI the demo will compile and run from the cmd line and if you think I can't figure that out -you are correct.   

Assuming that you actually are compiling your hello world app successfully at the command line, 1 of 2 things is likely:
1. You have multiple installations of same or similar GCC compiler which could be causing problems with the way C::B is detecting them. I suggest removing all GCC compilers but the one that works for you.
2. Your C::B compiler settings are screwed up. Probably want to clean out everything in \user\yourname\appdata\roaming\codeblocks
Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]

p2rkw

Quote
Then in the project I have linker options:glew32,freeglut,opengl32,glu32,winmm,gdi32 in that order.
Few years ago I had similar problem, so I created new project, add libraries to link again and it worked. Magic? No. Simply libraries order makes a difference: http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html Try to change libs order( maybe this one: freeglut glew32 glu32 opengl32 gdi32 winmm).

searcher

@dmoore:
Thankyou very much. I believe your second suggetion hit the target! CB is now working properly after I deleted CB folder from AppData (hidden) directory.
Now to test GLEW and get back to learning about graphics. Many thanks.

MortenMacFly

#24
Quote from: searcher on August 30, 2012, 10:39:29 PM
@jens:
The title of this section is "USING CODE::BLOCKS" , right?
Just for clarification: "Using" here assumes you know how to compile an application (your GLEW application on the command line for example) and don't know i.e. how to transfer the settings from the command line to the IDE after reading the documentation.

If you interpret "Using" as "all questions that raise while working with C::B" than this is wrong. We cannot and will not provide support for each and every single framework issue that might raise. The reason is simple:

  • We are no experts for other frameworks than the C::B SDK.
  • There are plenty expert forums around for other frameworks/SDK's were experts talk.
  • We want to focus on C::B development here only.

BTW: This is also explained clearly in the forum rules you agreed to. This is not because we don't want to help, we just don't want the forum to become a "general problem solver". That's it.

And as you see in the end: A screwed GCC installation has nothing to do with C::B.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

searcher

@MortenMacFly:
WELL excuse me but it was a down load of CB (or rather a reinstallation of CB) that caused the problem. If you are denying that mingw is part of the CB download then your use of English is not the same as mine.

Jenna

Quote from: searcher on August 31, 2012, 06:27:11 PM
@MortenMacFly:
WELL excuse me but it was a down load of CB (or rather a reinstallation of CB) that caused the problem. If you are denying that mingw is part of the CB download then your use of English is not the same as mine.

You can download a bC::B version bundled with MinGW, but we still are neither MinGW developer nor supporter.It's just bundled for the users convenience, to be able to start immediately.

By the way this topic is about glew, and as far as I know glew is not bundled with C::B as far as I know and the bundled MinGW works just fine on most windows installations.

Quote from: searcher on July 29, 2012, 11:47:19 PM
Problem setting up GLEW in CODE::BLOCKS.
Trying to setup example 1.2 from "OpenGL The BOOK " which requires GLEW.
I have searched all over the net but cannot find the procedure (thousands of others seem to have had the same problem !). The example does NOT use static linking. I am using C::B  10.0.5 on a Vista 64b O.S. I have tried using both the 64bit binaries and the source code to implement GLEW without success. A step by step lesson on making GLEW work would be much appreciated.
Thanks in advance for any assistance.


You are not able to figure out how to make an example of a book work, but in this case the aouthors of the book or the framework should probably be asked what you need.