How to use GLEW with Code::Blocks - linker

This seems to be a fairly common problem that I can't seem to find a good solution too. Most forums or questions I've read tell you what's wrong, but don't explain how to fix it very well. I've bee trying to setup GLEW with Code::Blocks and I've not been able to get it to work for about two weeks now, so there isn't much I haven't tried. I keep hitting linker errors such as:
obj\Debug\src\Graphics.o:D:\cold-fusion-engine\ColdFusion\src\Graphics.cpp|57|undefined reference to `_imp____glewGenBuffers'|
obj\Debug\src\Graphics.o:D:\cold-fusion-engine\ColdFusion\src\Graphics.cpp|59|undefined reference to `_imp____glewBindBuffer'|
obj\Debug\src\Graphics.o:D:\cold-fusion-engine\ColdFusion\src\Graphics.cpp|61|undefined reference to `_imp____glewBufferData'|
obj\Debug\src\Graphics.o:D:\cold-fusion-engine\ColdFusion\src\Graphics.cpp|63|undefined reference to `_imp____glewEnableVertexAttribArray'|
obj\Debug\src\Graphics.o:D:\cold-fusion-engine\ColdFusion\src\Graphics.cpp|64|undefined reference to `_imp____glewBindBuffer'|
obj\Debug\src\Graphics.o:D:\cold-fusion-engine\ColdFusion\src\Graphics.cpp|72|undefined reference to `_imp____glewVertexAttribPointer'|
obj\Debug\src\Graphics.o:D:\cold-fusion-engine\ColdFusion\src\Graphics.cpp|77|undefined reference to `_imp____glewDisableVertexAttribArray'|
||=== Build finished: 7 errors, 0 warnings ===|
How my linker is setup:
One thing I've read that might be wrong is that GLEW needs to be compiled to glew32.a instead of glew32.lib but I can't get the Makefile to work with Cygwin. I've also noticed this seems to be a some what common problem people have. I know it's a lot to ask but could someone possibly compile GLEW for Mingw and upload it or give a detailed step by step on how to do it? I'm having way more trouble with this than I should and it's driving me to the point of giving up on learning OpenGL 4 and just sticking with OpenGL 1.2.

I once wanted to test whether a big problem-is to make glew-1.9.0.
I assume you have msys and mingw on the same drive installed. e.g. C:\msys\1.0\ and C:\mingw*
downloaded glew-1.9.0.
set env path, put first inserted into the path variable x:\msys\1.0\bin;x:\mingw\bin;....
copy folder glew-1.9.0 to x:\msys\1.0\src\glew-1.9.0
start msys.bat
cd to top level /
cd to usr/src/glew-1.9.0
make
all these steps took about 10 minutes. And in the usr/src/glew-1.9.0/lib folder I can see
libglew32.a .. 15.08.2012
libglew32.dll.a .. 15.08.2012
libglew32mx.a .. 15.08.2012
libglew32mx.dll.a .. 15.08.2012
glew32.dll .. 15.08.2012
glew32mx.dll .. 15.08.2012
So where is the problem ??

Related

Compile/link Clipper .prg

I have some old codes which I use for my database.
I wrongly deleted the EXE files and now I only have some .BAT files for Clipper. The PRG files of my program which contains the source codes, and other files (DBF, NTX, ...).
How to make the exe files again? I found only a command to compile the PRG.
clipper myfile.prg
Execute:
clipper test.prg test.obj
blinker fi test.obj test.exe
if you have dependencies, check on your .rmk file.
touch project.rmk
rmake project.rmk
hope this helps
When using clipper to compile and plink86 to link, you need to also specify the clipper libraries. For example, if the only .prg file you are working on is zmenu.prg, then you would first:
clipper zmenu.prg
And then to link it:
plink86 fi zmenu lib clipper, extend
That's off the top of my head, but it should be close. If you can get your hands on a clipper manual I know it has more details on how to do this in the apendix of the manual.
I preferred linkfiles myself, but I dont remember the format. Then you just had to do:
plink86 #linkfile
So if you were doing compiling and testing a lot, it was easy to do without having to type the longer command each time.
I hope this helps. Wow, dusting off my clipper cobwebs :)
Very old question, but just to clarify in case anybody else has this issue, any MS compatible linker will work. You don't need a "Clipper" linker.

Compilation error on include with ljpeg library in C

I have a project for college, where i need to use libjpeg (C language), to complete 2 codes the teacher gave to us. It's a about transforming a pic into ASCII symbols (like the ASCII draws, you know)
We have a code for reading a jpg and a code for writing a jpg.
The problem is i had to install the libjpeg, i THINK the installation went well but i'm not sure so i have 2 questions
How can i verify libjpeg is correctly installed ? i didn't link it to gcc so i have to use the option for saying to gcc where is jpeg-6b (the folder which contains ljpeg) so i tried this :
Typing "gcc -L/jpeg-6b" the folder is jpeg-6b and it's right on the location where i do the command. i only get an error message about the fact the input is empty (normal ok), i think if the lib was not correctly installed, i should get an error for saying me i can't use the libjpeg version, right ?
In the 2 codes i said the teacher gave to us, she puts #include <libjpeg> on the beginning of it. But i saw on the internet that people use #include <jpeglib.h>, but both of them DON'T work and i get a message telling me :
test.c:1:21: fatal error: jpeglib.h: no such file or directory
#include <jpeglib.h>
is my include bad? or is the libjpeg bad installed ? (i read the doc and i did ./configure then make like it's said)
Just as you add -L/jpeg-6b you need -I/jpeg-6b/path/to/jpeg/headers too. I would recommend a Makefile to automate this.

Osgviewer cow does not view a cow?

I installed OpenSceneGraph 3.0.1using MacPorts.
I've tried osgversion -> OpenSceneGraph Library 3.0.1. I downloaded the OpenSceneGraph-Data.
Everything seems working well than osgviewer cow.osg takes hours without viewing anything !
please I need help ? is there a way to debug ?
Make sure you have defined the OSG_FILE_PATH environment variable and that it points to the data directory (the one with 'cow.osg').
You can then set OSG_NOTIFY_LEVEL to DEBUG_INFO to get extended information printed to the console. If for any reason the file could not be loaded correctly you will see where to start to troubleshoot.
You can also try to run
$ osgviewer --image /path/to/an/image.png
to test if the plugins work correctly.
Plugins are named e.g. osgdb_jpeg.dylib so you can look for these to make sure they have been built properly along with the core libraries and programs.
Try setting the notify level to DEBUG : Tips And Tricks
$ export OSG_NOTIFY_LEVEL=DEBUG
and run it and see if it says what's going on/going wrong.

Finding an absolute path to a folder in Cygwin

I am running a Eclipse for C/C++ using cygwin GCC. I need to get the library path of "libws2_32.a", which is in C:\cygwin\lib\w32api for me in windows. However I do not understand how this is translated into a cygwin-path.
I've tried stuff like:
/cygdrive/c/cygwin/lib/w32api
/lib/w32api
/usr/lib/w32api
Any ideas?
EDIT: update
Here's the make Eclipse log used for building, if it helps:
make all
Building target: Filesharing_core.dll
Invoking: Cygwin C Linker
gcc -L/cygdrive/c/cygwin/lib/w32api -shared -o"Filesharing_core.dll" ./src/test.o -llibws2_32.a
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -llibws2_32.a
collect2: ld returned 1 exit status
make: *** [Filesharing_core.dll] Error 1
It's not a problem with the path; it's a problem with the name of the library (the -l option).
Where you have entered libws2_32.a, instead enter ws2_32.
See the GCC manual for how the -l option works.
Generally, when asking for help with programming, don't describe, but show. Don't describe what you're doing; don't describe what you think the error is. Instead, show exactly what you're doing, show the exact code (or a cut down version that exhibits the same problem), and show the exact error message.
This way others don't have to guess as to what's wrong, and you are more likely to receive an answer right away that solves your problem.
You can use the find utility to find the file, although it may take a while.
find / -name libws2_32.a -print
Edit: Based on your edit to the question, simply move -llibws2_32.a to before ./src/test.o.
The folder C:\Opt\Cygwin\lib\w32api or whatever it is in your system is simply /lib/w32api from within Cygwin. The library you're looking for is /lib/w32api/libws2_32.a.
But I'm not sure what you're trying to achieve. I guess your Eclipse in running in Windows, and not from a Cygwin'ized version of Java? Why are you using Cygwin GCC? Do you want to compile for Cygwin? If not, MinGW or TDM-GCC would be the tool to pick.
If you do want to compile for the Cygwin environment using Eclipse (a combination I haven't tried), then user experience like the following might be helpful:
http://www.benjaminarai.com/benjamin_arai/index.php?display=/eclipsecygwingcc.php
(I simply googled: eclipse cygwin gcc)

CodeBlocks MinGW on XP noob. Is it possible to overwrite the same exe every time I compile? Further explanation inside

I have looked through both the CodeBlocks and MinGW FAQ and wiki to no avail. As stated above I am a noob.
I want CodeBlocks to act like a Unix compiler in that it overwrites a single output file every time it compiles unless told to do otherwise.
In Unix:
[cc example.c] -> [a.out], [cc example2.c] -> [a.out]. If I want to save the output file from being overwritten i just [cc -o newname example3.c] - [newname.out].
If this is possible with CodeBlocks/MinGW on XP I'd like to know how to do it. If not I would appreciate recommendations for another GUI compiler/IDE that could. Any help is appreciated. Thank you.
I want CodeBlocks to act like a Unix
compiler in that it overwrites..
First of all, C::B isn't a compiler -- it's an IDE. Saying you want C::B to act like a compiler makes no more sense then saying you want vim, emacs, or visual studio to 'act' like a compiler.
Second, you change the name of the final executable by right-clicking a project in your workspace. Goto properties->Build targets tab->select which build target you want to change. On the right side of this you'll see Output filename. Enter the executable filename the linker should output here. Alternatively, you can just navigate to the location of your existing executable and just rename it to something else.
And thirdly, chances are you're not even going to be checking back on this site so I'm probably just wasting my time giving an answer to your post.

Resources