Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: nikel on July 11, 2017, 04:36:43 pm

Title: Need help with code::blocks and gtk
Post by: nikel on July 11, 2017, 04:36:43 pm
Hi, I installed gtk 3.0 dev (using apt-get install), libwxgtk (using synaptic) and codeblocks (using apt-get). I'm getting error for my gtk project:

Quote
fatal error: gtk/gtk.h: no such file or directory

Here's a screenshot: (https://i.hizliresim.com/PrOgA9.png)
Title: Re: Need help with code::blocks and gtk
Post by: stahta01 on July 11, 2017, 05:54:34 pm
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F (http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F)

Is the GTK devel package installed?

Edit: After installing GTK devel package, did you exit out of Code::Blocks and reenter CB and try rebuilding.

Tim S.
Title: Re: Need help with code::blocks and gtk
Post by: nikel on July 11, 2017, 05:59:49 pm
Thanks for the quick reply. No I don't think so. I just tried

Code
sudo apt-get install gtk-devel

but I got error:

Quote
E: Unable to locate package gtk-devel
Title: Re: Need help with code::blocks and gtk
Post by: nikel on July 11, 2017, 06:24:12 pm
I installed codeblock after installing gtk. Anyway I tried dpkg-reconfigure codeblocks if you mean that, it still doesn't work. And searched a lot for rebuilding codeblocks however couldn't find anything useful. How can I rebuild CB?
Title: Re: Need help with code::blocks and gtk
Post by: stahta01 on July 11, 2017, 07:23:50 pm
POST A BUILD LOG!
Title: Re: Need help with code::blocks and gtk
Post by: stahta01 on July 11, 2017, 07:25:22 pm
http://wiki.codeblocks.org/index.php/FAQ-Compiling_(errors)#Q:_How_do_I_troubleshoot_a_compiler_problem.3F
Title: Re: Need help with code::blocks and gtk
Post by: stahta01 on July 11, 2017, 07:28:19 pm
Build -> Rebuild is how to rebuild a project.

Please try to follow the links I posted or I will have to just ignore you.

Tim S.

Title: Re: Build log
Post by: nikel on July 11, 2017, 09:23:06 pm
I rebuilded the project and here's its build log:

Quote
-------------- Clean: Debug in testproject01 (compiler: GNU GCC Compiler)---------------

Cleaned "testproject01 - Debug"

-------------- Build: Debug in testproject01 (compiler: GNU GCC Compiler)---------------

gcc -Wall -g  -c /home/nikel/Desktop/testproject01/testproject01/main.c -o obj/Debug/main.o
/home/nikel/Desktop/testproject01/testproject01/main.c:2:21: fatal error: gtk/gtk.h: No such file or directory
 #include <gtk/gtk.h>
                     ^
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))
Title: Re: Need help with code::blocks and gtk
Post by: BlueHazzard on July 12, 2017, 12:01:22 am
Have you created the project via the gtk project wizard from codeblocks, or did you created a c++ project?
Title: Re: Need help with code::blocks and gtk
Post by: nikel on July 12, 2017, 02:07:58 am
I created it via gtk project wizard. I'm trying to build c project.
Title: Re: Need help with code::blocks and gtk
Post by: ollydbg on July 12, 2017, 06:36:00 am
c - How to install gtk development dependencies on Ubuntu? - Stack Overflow - https://stackoverflow.com/questions/15390181/how-to-install-gtk-development-dependencies-on-ubuntu This link may help you.
Title: Re: Need help with code::blocks and gtk
Post by: Jenna on July 13, 2017, 06:32:19 am
If you use a wizard-created project, please check the compiler and linker settings:
"Build options -> [your project] -> Compiler settings -> Other compiler settings" and
"Build options -> [your project] -> Linker settings -> Other linker options".
Both will refer to gtk+2.0 pkg-config files, but Debian based  distros (most others nowadays also) use gtk3 as default.
So you have to fix these entries to point to the correct gtk-devel files.
It should be enough to change the "2" to a "3".
You can check it on a console.
You might need to close and reopen C::B to make this be recognized.
Title: Re: Need help with code::blocks and gtk
Post by: Jenna on July 13, 2017, 06:34:06 am
Thanks for the quick reply. No I don't think so. I just tried

Code
sudo apt-get install gtk-devel

but I got error:

Quote
E: Unable to locate package gtk-devel
And the package is called "libgtk-3-dev" or "libgtk2.0-dev" if you want gtk2.