Author Topic: Linking lib's in C::B  (Read 10725 times)

Offline perento

  • Multiple posting newcomer
  • *
  • Posts: 47
Linking lib's in C::B
« 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!

Offline jarod42

  • Multiple posting newcomer
  • *
  • Posts: 82
Re: Linking lib's in C::B
« Reply #1 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.

Offline perento

  • Multiple posting newcomer
  • *
  • Posts: 47
Re: Linking lib's in C::B
« Reply #2 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!

Offline perento

  • Multiple posting newcomer
  • *
  • Posts: 47
Re: Linking lib's in C::B
« Reply #3 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.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9594
Re: Linking lib's in C::B
« Reply #4 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline perento

  • Multiple posting newcomer
  • *
  • Posts: 47
Re: Linking lib's in C::B
« Reply #5 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.


Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9594
Re: Linking lib's in C::B
« Reply #6 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...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline perento

  • Multiple posting newcomer
  • *
  • Posts: 47
Re: Linking lib's in C::B
« Reply #7 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 !

Offline perento

  • Multiple posting newcomer
  • *
  • Posts: 47
Re: Linking lib's in C::B
« Reply #8 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?
« Last Edit: June 27, 2012, 11:32:24 pm by perento »

Offline perento

  • Multiple posting newcomer
  • *
  • Posts: 47
Re: Linking lib's in C::B
« Reply #9 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.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12597
    • Travis build status
Re: Linking lib's in C::B
« Reply #10 on: June 29, 2012, 10:23:18 am »
Please post the full log if you really want to get some help...
(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 perento

  • Multiple posting newcomer
  • *
  • Posts: 47
Re: Linking lib's in C::B
« Reply #11 on: June 29, 2012, 11:35:37 am »
I included this with the default Win32 GUI code
Code: [Select]
#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

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7253
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Linking lib's in C::B
« Reply #12 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 !

Offline perento

  • Multiple posting newcomer
  • *
  • Posts: 47
Re: Linking lib's in C::B
« Reply #13 on: June 29, 2012, 01:25:35 pm »
Renamed it at 'openGLtuts', still searching in folder 'tutorials'.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12597
    • Travis build status
Re: Linking lib's in C::B
« Reply #14 on: June 29, 2012, 02:02:53 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!]