User forums > Help
Code::Blocks and GTK+ compile-link in Windows over KMD.EXE
sklimkin:
--- Quote from: stahta01 on June 15, 2012, 03:29:50 am ---Read
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F
Note: The above might not apply; but, since I read your post twice and still did not find a clear question. I have to go with the default link that I post.
Tim S.
--- End quote ---
This page new and the useful didn't tell anything to me.
C ++ not my programming language, I write on plain-C
MSVC not my compiler, I use gcc
Humour - a fine thing. But I will make one specification: I don't know English for talk. Only that is necessary for computer technologies and programming.
in case of communication with you I use the program of computer transfer (Promt - http://www.translate.ru) therefore "the subtle English humour" in the original is unavailable to me.
If at answering my question there is knowledge and good will, ask a reality in responses.
One more specification: in Russian my response not is a roughness sign, only an efficiency sign.
sklimkin:
--- Quote from: MortenMacFly on June 15, 2012, 08:45:54 am ---
--- Quote from: ollydbg on June 15, 2012, 03:51:50 am ---I think the OP want to wrote a tutorial.
--- End quote ---
Yes, but a very bad one: Adding include path's to the system's PATH environment is completely bullshit.
--- End quote ---
I didn't find the other/best mode of work in Windows with the compiler and a linker from command line.
Line #include <gtk/gtk.h> mandatory in all programs using gtk library and smart internal communications/links in package GTK+ demanded it.
Moreover: without it the program successfully compiled and executed in the environment of Code::Blocks isn't executed if it to launch from the directory ../projects/bin/debug/
It doesn't find libraries for dynamic binding.
stahta01:
read http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_I_would_like_to_compile_a_project_using_some_non-standard_libraries._How_can_I_indicate_to_CodeBlocks_that_these_libraries_and_include_files_exist.3F
Try putting this in other options
--- Code: ---`pkg-config --libs gtk+-2.0`
--- End code ---
The values inside the tick marks are converted to the result of the command ran on the command line (cmd.exe). (I think this happens on CB project load).
If Compiler options, put it in other compiler option.
If Linker options, put it in other linker option.
Both the other options locations should be one entry per line.
Tim S.
MortenMacFly:
...why don't you simply start wiht he GTK tempklate we have in Code::Blocks, or use the GTK project wizard, present in Code::Blocks, too.
If unsure where to setup which options, this is explained in the WiKi and also the documentation (see my sig).
A general advise from my side: Try to compile at the command line first, this should be the same as in linux except you have to exchange the include / library path's and maybe adjust some linker flags. If that works, you know all parameters you have to use inside the IDE. In addition you have a good learning curve to understand the functionality of the compiler/linker.
sklimkin:
--- Quote from: MortenMacFly on June 15, 2012, 07:04:58 pm ---...why don't you simply start wiht he GTK tempklate we have in Code::Blocks, or use the GTK project wizard, present in Code::Blocks, too.
... ... ...
--- End quote ---
In my "gtk4" example each window and each element of a window it is declared as GtkWidget.
Compilation in Code::Blocks shows it as errors.
Compilation of the same example from command line comes to the end successfully, there are only warnings.
I well understand that these discrepancies "sit" in GTK library, but there are they by operation in Code::Blocks.
Moreover: in case of compilation of this example from Code::Blocks under Linux warnings and the program were given out only was compiled, collected and it works.
I don't state any claims to developers of Code::Blocks, opposite - this development environment allowed me to pass quite easily from Windows + Pelles-C to Linux + GTK. I want to share the observations with other users.
Possibly it will be useful for them.
If the administration of a forum doesn't wish discussion of such subjects, I certainly will cease to write. Though the subject not absolutely offtop seems to me that.
I will tell it is more: even the Windows OS me doesn't interest in any way. But I want to understand: why nobody could port GTK library on WinCE/Mobile. certain successes developers have porting mingw-ce + winAPI-ce.
There is a porting of this library on HP iPAQ hx4700 type devices as a part of the Linux OS (for example Angstrom), but it is not known, how programs using GTK will work.
Here therefore I also decided to look at GTK operation at least in Win32.
Here is how the project configuration in CodeBlocks for Win32 gcc GTK at me today looks:
--- Quote ---To make in Windows Code::Blocks WORKING cgg & GTK+ project write manually:
--------------------------------------------------------------------------
0. Select and insert ONLY NEXT settings/strings, all others must bee EMPTY
--------------------------------------------------------------------------
1. Menu -> Settings -> Compiler and debugger ...
1a. Selected compiler -> GNU GCC COmpiler
1b. -> Search directories -> Compiler
C:\CodeBlocks\MinGW\bin
C:\Gtk+\bin
C:\Gtk+\lib
C:\Gtk+\include
C:\Gtk+\include\gtk-2.0\gtk
C:\Gtk+\include\gtk-2.0\gdk
C:\Gtk+\include\cairo
-> Search directories -> Linker
C:\CodeBlocks\MinGW\bin
C:\Gtk+\bin
C:\Gtk+\lib
C:\Gtk+\pkgconfig
-> Search directories -> Resource compiler
C:\CodeBlocks\MinGW\bin
1c. -> Toolchain executables
Compiler's installation directoty: C:\CodeBlocks\MinGW
-> Toolchain executables -> Program Files
C compiler: gcc.exe
C++ compiler: g++.exe
Linker for dinamic libs: g++.exe
Linker for static libs: gprofs.exe (??? static-linking don't work at all !!!)
Debugger: gdb.exe
Resource compiler: windres.exe
Make program: mingw32-make.exe
1d. -> Other settings
Compiler logging: Full command line (select if you wish)
2. Menu -> Settings -> Global variables ...
-> Current variable: <New> add manually: gtk2 (for example)
Building fields: base
C:\CodeBlocks\MinGW
include
C:\CodeBlocks\MinGW\include
lib
C:\CodeBlocks\MinGW\lib
obj
C:\CodeBlocks\MinGW\lib (or leave empty)
cflags
pkg-config --cflags gtk+-2.0
lflags
pkg-config --libs gtk+-2.0
3. Menu -> Project -> build options...
In tree select ONLY <project-name>, not <Debug>, not <Release>
Project -> Project build options -> Compiler settings -> Other options:
-mms-bitfields
-> Linker settings -> Other linker settings
`pkg-config --cflags gtk+-2.0`
`pkg-config --libs gtk+-2.0`
-> Search directories -> Compiler
C:\GTK+\bin
C:\GTK+\lib
C:\GTK+\include
C:\GTK+\lib\pkgconfig
C:\GTK+\include\gtk-2.0
C:\GTK+\include\glib-2.0
C:\GTK+\lib\glib-2.0\include
C:\GTK+\include\pango-1.0
C:\GTK+\include\atk-1.0
!!! After all leave ALL fields in <Debug> & <Release> pages EMPTY !!!
---------------------------------------------------------------------
??? Maybe for Cairo need also ??? (NOW I don't know - test required):
-> Search directories -> Linker
C:\GTK+\bin
C:\GTK+\lib
C:\GTK+\include
C:\GTK+\include\atk-1.0
C:\GTK+\include\cairo
C:\GTK+\include\fontconfig
C:\GTK+\include\gdk-pixbuf-2.0
C:\GTK+\include\gio-win32-2.0
C:\GTK+\include\glib-2.0
C:\GTK+\include\gtk-2.0
C:\GTK+\include\gtk-2.0\gtk
C:\GTK+\include\gtk-2.0\gdk
C:\GTK+\include\libpng14
C:\GTK+\include\pango-1.0
-------------------------------------------------
--- End quote ---
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version