News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Need help with code::blocks and gtk

Started by nikel, July 11, 2017, 04:36:43 PM

Previous topic - Next topic

nikel

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:

Quotefatal error: gtk/gtk.h: no such file or directory

Here's a screenshot:

stahta01

#1
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.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

nikel

Thanks for the quick reply. No I don't think so. I just tried

sudo apt-get install gtk-devel

but I got error:

QuoteE: Unable to locate package gtk-devel

nikel

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?

stahta01

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01

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.

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

nikel

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))

BlueHazzard

Have you created the project via the gtk project wizard from codeblocks, or did you created a c++ project?

nikel

I created it via gtk project wizard. I'm trying to build c project.

ollydbg

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.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Jenna

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.

Jenna

Quote from: nikel on July 11, 2017, 05:59:49 PM
Thanks for the quick reply. No I don't think so. I just tried

sudo apt-get install gtk-devel

but I got error:

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