Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: perento on June 26, 2012, 02:14:58 pm

Title: Linking lib's in C::B
Post by: perento on June 26, 2012, 02:14:58 pm
Just starting to learn openGL , this article is for working with Visual C++, but I honestly dont feel comfortable with it.
http://nehe.gamedev.net/tutorial/creating_an_opengl_window_(win32)/13001/# The first few lines make me ask the next question.
Quote
After you have created a new Win32 Application (NOT a console application) in Visual C++, you will need to link the OpenGL libraries. In Visual C++ go to Project, Settings, and then click on the LINK tab. Under "Object/Library Modules" at the beginning of the line (before kernel32.lib) add OpenGL32.lib GLu32.lib and GLaux.lib. Once you've done this click on OK. You're now ready to write an OpenGL Windows program.
How can i link those while in Code::Blocks IDE?
I relly dont get into Visual C++ and feel very uncomfortable, is there a way to stay with Code::Blocks for those tutorials?
Thanks!
Title: Re: Linking lib's in C::B
Post by: jarod42 on June 26, 2012, 03:08:40 pm
In Project -> Build options... ->
Linkers settings : Link libraries
and Search Directories
'Compiler' for paths where search include
'Linker' for paths where search libraries.

Note also that VC libraries are not compatible with gcc.
So, choose libraries compatible with your toolchain.
Title: Re: Linking lib's in C::B
Post by: perento on June 26, 2012, 05:10:59 pm
Ok and wich one is the Win32 Application? I see only Win32 GUI project.
And, OpenGL32.lib GLu32.lib and GLaux.lib, are they compatible with my toolchain (I dont know what is, or how to check it, please excuse, its my first time setting up something different than creating a C++ simple project).

Thanks!
Title: Re: Linking lib's in C::B
Post by: perento on June 27, 2012, 01:44:13 pm
Sorr yfor the double post, one last question please.
Does Code::Blocks support Win32 Aplication (Not console aplication) ? Thanks.
Title: Re: Linking lib's in C::B
Post by: MortenMacFly on June 27, 2012, 01:59:06 pm
Does Code::Blocks support Win32 Aplication (Not console aplication) ? Thanks.
Yes. C::B supports everything a compiler can create. If your compiler can compile Win32 code (which all Win32 compilers do) then yes.
Title: Re: Linking lib's in C::B
Post by: perento on June 27, 2012, 02:37:38 pm
Yes. C::B supports everything a compiler can create. If your compiler can compile Win32 code (which all Win32 compilers do) then yes.

But i dont see Win32 Aplication, I see only Console Aplication and Win32 GUI Project.
I have to create such win32 Alication, and then to link the libraries i need, please excuse my begginer expirience.

Title: Re: Linking lib's in C::B
Post by: MortenMacFly on June 27, 2012, 03:17:47 pm
But i dont see Win32 Aplication, I see only Console Aplication and Win32 GUI Project.
Oh dear, these are only templates for convenience, far from being complete to what we could support. You can create a new (empty) project and add files as you need.

Alternatively if you insist on on using templates, gust create a Win32 UI project and remove the UI part...
Title: Re: Linking lib's in C::B
Post by: perento on June 27, 2012, 07:37:10 pm
Create Win32 GUI project, dialog one, I link those 3 lib's in the "Link libraries" and Search directories is the project folder. When i include the headers <gl\gl.h>, <gl\glu.h>, <gl\glaux.h> a massage pop-up saying "It seems that this project has not been built yet. Do you wish to build it?"
Can't build and run the project, where do i mistake?

I guess those are some common mistakes and i can search if needed, thought i could ask.

PS: Great IDE, glad i can allmost start learn my openGL tutorials on Code::Blocks !
Title: Re: Linking lib's in C::B
Post by: perento on June 27, 2012, 11:24:43 pm
Found out that i have no .exe file in bin\debug\......exe but the Output Filename says i have bin\debug\Triangles.exe, wich i cant find in this folder when i try own search

Triangles is the proj name

edit: Build log window says: mingw32-g++.exe: no input files
edit2: Found that Triangles mingw is trying to get Triangles from folder 'tutorials', Triangles is in folder 'openGL tutorials', how to fix this?
Title: Re: Linking lib's in C::B
Post by: perento on June 29, 2012, 10:17:51 am
I searched other threads in this forum to collect the data i posted in my previous post.
Anyone, if possible help.
Title: Re: Linking lib's in C::B
Post by: oBFusCATed on June 29, 2012, 10:23:18 am
Please post the full log if you really want to get some help...
Title: Re: Linking lib's in C::B
Post by: perento on June 29, 2012, 11:35:37 am
I included this with the default Win32 GUI code
Code
#define WIN32_LEAN_AND_MEAN

#include "resource.h"
#include <windows.h>
#include <gl\gl.h>
#include <gl\glu.h>
#include <gl\glaux.h>

The build log said:
-------------- Build: Debug in Triangles ---------------

Compiling: main.cpp
D:\Programs\CodeBlocks\openGL tutorials\Triangles\main.cpp:7:60: error: gl\glaux.h: No such file or directory
mingw32-g++.exe: tutorials\Triangles": No such file or directory
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings

This line here, mingw32-g++.exe: tutorials\Triangles", 'Triangles' should be in 'openGL tutorials' folder and it is there if i search on my own.

When i make #include <gl\glaux.h> as comment

massage pop-up said:
"It seems that this project has not been built yet. Do you wish to build it?"
When i press "Yes":
-------------- Build: Debug in Triangles ---------------

Linking console executable: bin\Debug\Triangles.exe
mingw32-g++.exe: tutorials\Triangles": No such file or directory
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings
Title: Re: Linking lib's in C::B
Post by: Jenna on June 29, 2012, 11:44:47 am
As first don't use paths with spaces in it on windows, that leads to problems with some versions of MinGW !
Title: Re: Linking lib's in C::B
Post by: perento on June 29, 2012, 01:25:35 pm
Renamed it at 'openGLtuts', still searching in folder 'tutorials'.
Title: Re: Linking lib's in C::B
Post by: oBFusCATed on June 29, 2012, 02:02:53 pm
perento:
You've not posted the full log!
Please read this: http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F
Title: Re: Linking lib's in C::B
Post by: perento on June 29, 2012, 02:46:44 pm
I think should be this
Code
Scanning for lexers in C:\Documents and Settings\User\Application Data\codeblocks/share/codeblocks/lexers/...
Found 0 lexers
Scanning for lexers in D:\Programs\CodeBlocks/share/codeblocks/lexers/...
Found 4 lexers
Loading lexer_cpp
Loading lexer_rc
Loading lexer_squirrel
Loading lexer_xml
Configured 0 tools
Scanning for plugins in C:\Documents and Settings\User\Application Data\codeblocks/share/codeblocks/plugins
Loaded 0 plugins
Scanning for plugins in D:\Programs\CodeBlocks/share/codeblocks/plugins
Loaded 39 plugins
Loading:
AStylePlugin
Autosave
AutoVersioning
BrowseTracker
BYOGames
CB_Koders
Cccc
ClassWizard
CodeCompletion
CodeSnippets
CodeStat
Compiler
copystrings
CppCheck
Debugger
FilesExtensionHandler
DevPakUpdater
cbDragScroll
EnvVars
Exporter
HeaderFixup
HelpPlugin
HexEditor
IncrementalSearch
cbKeyBinder
lib_finder
MouseSap
OpenFilesList
Profiler
ProjectsImporter
RegExTestbed
ScriptedWizard
SymTab
ThreadSearch
ToDoList
wxSmith
wxSmithMime
wxSmithAui
wxSmithContribItems
WindowsXPLookNFeel
Running startup script
Script/function 'edit_startup_script.script' registered under menu '&Settings/-Edit startup script'

Also when i start new Win32 GUI project Frame based and link nothing but only include
Code
#include <windows.h>
#include <gl\gl.h>
#include <gl\glu.h>
#include <gl\glaux.h>
I get this in the Build log:
Code
D:\Programs\CodeBlocks\openGLtuts\triangles\main.cpp:5:59: error: gl\glaux.h: No such file or directory
This time searches in the correct folder.

When i make
Code
#include <gl\glaux.h>
a comment, the project is building and runing without problems; this with the default Frame based code from Code::Blocks.
Title: Re: Linking lib's in C::B
Post by: MortenMacFly on June 29, 2012, 02:57:01 pm
I think should be this
Nope, wrong. Obviously you are too lazy to read whats requested.

Code
D:\Programs\CodeBlocks\openGLtuts\triangles\main.cpp:5:59: error: gl\glaux.h: No such file or directory
This is part of the build log, please post the full build log, or go away. Thank you. BTW: If you google for this you would get millions of answers, too. >:(
Title: Re: Linking lib's in C::B
Post by: perento on July 01, 2012, 12:20:19 pm
glaux.h is kinda old and so supported anymore, i readed around the forums. I will try replace it with something else that is supported and up to date.

Really sorry for the disturbing, it was first time to setting up a compiler and i didnt want to move to Visual.
Keep the work, please .