Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: jdn_Jonny on December 11, 2015, 06:40:27 am

Title: Simple OpengGL project port from VS to CB
Post by: jdn_Jonny on December 11, 2015, 06:40:27 am
Hey guys,

I have been working with GLFW and GLEW in Visual Studio, no problem. Now I downloaded codeblocks, and would like to port my code over to code blocks before it gets so big I won't feel like doing it.

I tested the basic OpenGL demo (triangle) which runs without any issues. But when I create an empty project myself, add GLEWand GLFWto it, and compile it, it gives me a bunch of unresolved externals, such as:

'undefined reference to _imp__glewInit@0'
C:\Dev Tools\Middleware\GLFW\lib\Debug\glfw3.lib(glfw.dir\Debug\window.obj):(.text$mn+0xc7)||undefined reference to `_RTC_CheckEsp'|

I'm using the exact same header files & lib files I used in Visual Studio, where they worked. All I did there, was include the headers, and the libs in the project, add GLEW_STATIC and that's it...

So anyway, under linker, I have added the lib files, under compiler i have added the include files. In fact, I know codeblocks finds them, if it didn't it'd say something like "can't find glew32s.lib" or whatever. I also declared GLEW static...

I'm using the built in GNU GCC compiler. GCC, G++ v5.2.0

Win 7

Please help guys, what am I missing? I've just started with code blocks, but it can't be that hard if there's an OpenGL project already coming with codeblocks.

I have tried setting up a GLFW project too, but it keeps saying that the header file is not found, since it's looking for glfw.h instead of glfw3.h...

Thank you ever so much in advance
Title: Re: Simple OpengGL project port from VS to CB
Post by: Jenna on December 11, 2015, 06:54:16 am
Do you use libs compiled for/with VS with gcc ?
Title: Re: Simple OpengGL project port from VS to CB
Post by: stahta01 on December 11, 2015, 07:07:01 am
http://wiki.codeblocks.org/index.php/FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F (http://wiki.codeblocks.org/index.php/FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F)

Did you define GLEW_STATIC in Code::Blocks? If no, why not?

Tim S.
Title: Re: Simple OpengGL project port from VS to CB
Post by: jdn_Jonny on December 11, 2015, 07:16:00 am
jens - I compiled GLFW myself with VS, indeed. GLEW was a downloaded binary. So I'm going to go ahead and assume that it was probably built with VS as well, that why it worked? I tried vcompiling GLEW meself but the source seemed like it was all over the place, VS didn't find the majority of the files and dependencies so I gave up and just went with a precompiled version, which worked...

Btw I'm more than happy to share files if anyone cares to look into it?

stahta01 -  "I also declared GLEW static..." so yeah, I did :p
Title: Re: Simple OpengGL project port from VS to CB
Post by: stahta01 on December 13, 2015, 05:40:56 pm
If you still want help post the full rebuild log; if no log is posted I for one will ignore this thread.

http://wiki.codeblocks.org/index.php/FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F (http://wiki.codeblocks.org/index.php/FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F)

Tim S.