Author Topic: Set up GLEW in CODE::BLOCKS  (Read 44351 times)

Offline searcher

  • Multiple posting newcomer
  • *
  • Posts: 18
Set up GLEW in CODE::BLOCKS
« 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.

stefanos_

  • Guest
Re: Set up GLEW in CODE::BLOCKS
« Reply #1 on: July 30, 2012, 11:07:37 am »
You know, i just can't believe that I used to say the same old newbie lie that "I have searched the entire net...". Now that I am thinking about it, I feel so embarrassed myself  :-[

If you have done your research, give me the last 1000 searches you have done, including this forum here, Google, and any other candidate searching method..because I have seen this question getting answered infinite times by now :/

  • Search this forum please...
  • Use any search engine of your choice with keywords like "codeblocks glew"
  • Leave the enthusiasm on the side and get your butt on the chair by doing some research if you want to take programming seriously man! I am not attacking you, just shaking you a bit to wake up.

Offline searcher

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: Set up GLEW in CODE::BLOCKS
« Reply #2 on: July 30, 2012, 02:18:14 pm »
I wonder how rude you could be if you really tried ?
While there are many sites that purport to tell people what to do I have yet to find one on this or any other forum that shows HOW to do. Contrary to your ignorant rant I have tried to implement the "instructions" about recompiling the source codes etc. but so far without success. You would do well to remember the old adage "if you can't find anything good to say shut up !!".

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Set up GLEW in CODE::BLOCKS
« Reply #3 on: July 30, 2012, 02:39:09 pm »
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

stefanos_

  • Guest
Re: Set up GLEW in CODE::BLOCKS
« Reply #4 on: July 30, 2012, 03:07:45 pm »
First of all, I would like to warn you to watch your tongue; i have not spoken to you in this tone and i can admit that i was on purpose a bit strict with you for your own good. I gave you powerful advice to realize that if you go to work and say to your boss that you don't know how to sort a linkage issue, you just lost the game AND your job.

Now, to get some serious business here, I have searched this forum and found in 2 seconds 4 related articles to GLEW and if I am not mistaken, they have something to do with linkage; i did not pay much attention because i care the less.

http://forums.codeblocks.org/index.php/topic,4431.0.html    [09-11-2006]
http://forums.codeblocks.org/index.php/topic,7322.0.html    [21-11-2007]
http://forums.codeblocks.org/index.php/topic,14927.0.html   [29-06-2011]
http://forums.codeblocks.org/index.php/topic,13055.0.html   [08-08-2010]

Cheers

P.S.: Don't say "shut up" so easily to people you don't know. It's a small world we live in and you never know; you might need a job in the near future and i might be your candidate boss. At least, take this as an advice!

Offline searcher

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: Set up GLEW in CODE::BLOCKS
« Reply #5 on: July 30, 2012, 04:12:31 pm »
@obfuscated
Thankyou for trying to be helpful. I had already seen these sites.One of them refers to static linking which I do not want for the quoted example, the other didn't work for me but I may try it again to see if I can make it work.
Thankyou anyway.

Offline searcher

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: Set up GLEW in CODE::BLOCKS
« Reply #6 on: July 30, 2012, 04:17:06 pm »
@stefanos.
First of all You are the one who needs to be reprimanded. Your "reply" started by calling me a liar - if that is your idea of politeness you need some lessons in manners.
None of the sources you quote (all of which I have previously examined) is relevant to my request.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Set up GLEW in CODE::BLOCKS
« Reply #7 on: July 30, 2012, 04:25:25 pm »
searcher:
What is the problem with this solution http://stackoverflow.com/a/6932318 ?
And what is the problem with using the dlls directly? As far as I know newer mingw/tdm gcc support directly linking to the dll.
I'm using glew, but I don't remember what I did to make it build.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Set up GLEW in CODE::BLOCKS
« Reply #8 on: July 30, 2012, 06:49:12 pm »
Getting GLEW to work (it's admittedly some time since I've last used it, but either way) is really a matter of reading the 20 or so lines of installation howto on the GLEW website. It boils down to having GLEW_STATIC set or not set, depending on what you want. If you don't want to link dynamically (though it's silly to insist on that if you already have a DLL and just want to get a book example running...), you'll have to set that variable.

That done, it's max 1-2 mins to have a running program.

I don't see how it's much related to Code::Blocks, however.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline searcher

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: Set up GLEW in CODE::BLOCKS
« Reply #9 on: August 22, 2012, 05:59:43 pm »
Update to my request: I used msys on the source file glew-1.9.0 and obtained the following-
glew32.dll, libglew32.a and libglew32.dll.a. I put glew32.dll in C:\windows\sysWOW64.
The other two went into ....\MinGW\lib
The headers are in the correct location. Then in the project I have linker options:glew32,freeglut,opengl32,glu32,winmm,gdi32 in that order.
Problem ch1.1 from openGLBook works fine so freeglut is O.K. Problem ch1.2 which adds glew give the following list of errors.||=== chapter1.2, Debug ===|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\crt2.o:crt1.c|| undefined reference to `SetUnhandledExceptionFilter@4'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\crt2.o:crt1.c|| undefined reference to `ExitProcess@4'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\crtbegin.o:cygming-crtbegin.c|| undefined reference to `GetModuleHandleA@4'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\crtbegin.o:cygming-crtbegin.c|| undefined reference to `GetProcAddress@8'|
obj\Debug\main.o||In function `glutInit_ATEXIT_HACK':|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\GL\freeglut_std.h|612|undefined reference to `_imp____glutInitWithExit@12'|
obj\Debug\main.o||In function `glutCreateWindow_ATEXIT_HACK':|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\GL\freeglut_std.h|614|undefined reference to `_imp____glutCreateWindowWithExit@8'|
obj\Debug\main.o||In function `glutCreateMenu_ATEXIT_HACK':|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\GL\freeglut_std.h|616|undefined reference to `_imp____glutCreateMenuWithExit@8'|
obj\Debug\main.o||In function `main':|
C:\Users\DrMike\Graphics\chapter1.2\main.cpp|43|undefined reference to `_imp__glutMainLoop@0'|
obj\Debug\main.o||In function `Z10InitializeiPPc':|
C:\Users\DrMike\Graphics\chapter1.2\main.cpp|69|undefined reference to `glGetString@4'|
C:\Users\DrMike\Graphics\chapter1.2\main.cpp|71|undefined reference to `glClearColor@16'|
obj\Debug\main.o||In function `Z10InitWindowiPPc':|
C:\Users\DrMike\Graphics\chapter1.2\main.cpp|78|undefined reference to `_imp__glutInitContextVersion@8'|
C:\Users\DrMike\Graphics\chapter1.2\main.cpp|79|undefined reference to `_imp__glutInitContextFlags@4'|
C:\Users\DrMike\Graphics\chapter1.2\main.cpp|80|undefined reference to `_imp__glutInitContextProfile@4'|
C:\Users\DrMike\Graphics\chapter1.2\main.cpp|85|undefined reference to `_imp__glutSetOption@8'|
C:\Users\DrMike\Graphics\chapter1.2\main.cpp|87|undefined reference to `_imp__glutInitWindowSize@8'|
C:\Users\DrMike\Graphics\chapter1.2\main.cpp|89|undefined reference to `_imp__glutInitDisplayMode@4'|
C:\Users\DrMike\Graphics\chapter1.2\main.cpp|101|undefined reference to `_imp__glutReshapeFunc@4'|
C:\Users\DrMike\Graphics\chapter1.2\main.cpp|102|undefined reference to `_imp__glutDisplayFunc@4'|
obj\Debug\main.o||In function `Z14ResizeFunctionii':|
C:\Users\DrMike\Graphics\chapter1.2\main.cpp|109|undefined reference to `glViewport@16'|
obj\Debug\main.o||In function `Z14RenderFunctionv':|
C:\Users\DrMike\Graphics\chapter1.2\main.cpp|114|undefined reference to `glClear@4'|
C:\Users\DrMike\Graphics\chapter1.2\main.cpp|116|undefined reference to `_imp__glutSwapBuffers@0'|
C:\Users\DrMike\Graphics\chapter1.2\main.cpp|117|undefined reference to `_imp__glutPostRedisplay@0'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libmingw32.a(pseudo-reloc.o):pseudo-reloc.c|| undefined reference to `VirtualQuery@12'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libmingw32.a(pseudo-reloc.o):pseudo-reloc.c|| undefined reference to `VirtualProtect@16'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libmingw32.a(pseudo-reloc.o):pseudo-reloc.c|| undefined reference to `VirtualProtect@16'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\libgcc.a(cygming-shared-data.o)||In function `cmshared_get_ptr_from_atom':|
c:\crossdev\b4.4.1-tdm-1\build-sjlj\mingw32\libgcc\..\..\..\..\gcc-4.4.1\libgcc\..\gcc\config\i386\cygming-shared-data.c|91|undefined reference to `GetAtomNameA@12'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\libgcc.a(cygming-shared-data.o)||In function `_cmshared_create_or_grab':|
c:\crossdev\b4.4.1-tdm-1\build-sjlj\mingw32\libgcc\..\..\..\..\gcc-4.4.1\libgcc\..\gcc\config\i386\cygming-shared-data.c|140|undefined reference to `FindAtomA@4'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\libgcc.a(cygming-shared-data.o)||In function `cmshared_add_ptr_as_atom':|
c:\crossdev\b4.4.1-tdm-1\build-sjlj\mingw32\libgcc\..\..\..\..\gcc-4.4.1\libgcc\..\gcc\config\i386\cygming-shared-data.c|118|undefined reference to `AddAtomA@4'|
||=== Build finished: 28 errors, 0 warnings ===|   HELP!!!

Offline searcher

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: Set up GLEW in CODE::BLOCKS
« Reply #10 on: August 27, 2012, 08:52:13 pm »
Hello again:
In trying to find the source of my problem I have discovered the following.
In my path variable, one of the entries is :

  C:\program files (x86)\codeblocks\mingw\libexec\gcc\x-86-64-pc-mingw32\4.7.1

However, when I try to locate this I find instead :

           ...........\libexec\gcc\mingw32\4.4.1

Could this be the source of my problem ? Does someone know what to do ?
Please help if you can. Thankyou.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Set up GLEW in CODE::BLOCKS
« Reply #11 on: August 28, 2012, 06:49:57 am »
In my path variable, one of the entries is :
  C:\program files (x86)\codeblocks\mingw\libexec\gcc\x-86-64-pc-mingw32\4.7.1
However, when I try to locate this I find instead :
           ...........\libexec\gcc\mingw32\4.4.1
None of these should be in your PATH environment. I don't know why you did that, but I wouldn't wonder if this screws things.

Altogether it looks like you are mixing compiler versions here. Did you overwrite an existing compiler installation with another? Did you install multiple compilers with different version and apply them all in PATH? Try to locate all GCC compilers on your machine, remove them all and install a new (your target compiler) from scratch.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline searcher

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: Set up GLEW in CODE::BLOCKS
« Reply #12 on: August 28, 2012, 10:52:33 pm »
@MortenMacFly:
Thankyou for a reply. Yes I may have made a mistake in installation when I downloaded MSYS in order to build GLEW from source. As you suggest I have removed both CodeBlocks-MinGw10.0.5 and MSYS in order to get rid of the compilers. I can easily reinstall codeblocks. However, I don't know what to do about the PATH - currently it looks like this:
c:\program files (x86)\codeblocks\mingw\bin;c:\program files (x86)\codeblocks\mingw\libexec\gcc\x86-64-pc-mingw32\4.7.1;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\10.0\DLLShared\;C:\Program Files (x86)\jZip;C:\Program Files\Windows Imaging\;C:\Program Files (x86)\codeblocks\MinGW\bin\;C:\msys\1.0\bin;C:\windows\sysWOW64\

I do know how to edit - but I am not at all sure what should be left in and what removed. Your expert advice would be much appreciated. (The GLEW problem can wait for now !). Thanks.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Set up GLEW in CODE::BLOCKS
« Reply #13 on: August 29, 2012, 06:41:21 am »
I do know how to edit - but I am not at all sure what should be left in and what removed.
It depends on you OS - google for "change PATH environment variable [YOUR OS]".

Remove all these references(some occur multiple times):
c:\program files (x86)\codeblocks\mingw\bin
c:\program files (x86)\codeblocks\mingw\libexec\gcc\x86-64-pc-mingw32\4.7.1
C:\Program Files (x86)\codeblocks\MinGW\bin\
C:\msys\1.0\bin
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline searcher

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: Set up GLEW in CODE::BLOCKS
« Reply #14 on: August 29, 2012, 04:22:14 pm »
@MortenMacFly:
I have edited the PATH re your suggestion. Everything seems to be O.K. except for the original problem with GLEW detailed above - same 28 error messages as before.
One thing I noticed (may be irrelevant) is on the compiler global settings, tool chain executables page. The last entry indicates "make" however there is no such file in the listed directory. There IS a file called "mingw32-make" ????
Thankyou for your assistance.


[attachment deleted by admin]