Author Topic: Need help with code::blocks and gtk  (Read 616 times)

Offline nikel

  • Single posting newcomer
  • *
  • Posts: 5
Need help with code::blocks and gtk
« 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:
« Last Edit: July 11, 2017, 04:49:30 pm by nikel »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 5899
    • My Best Post
Re: Need help with code::blocks and gtk
« Reply #1 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

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.
« Last Edit: July 11, 2017, 05:59:22 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Testing, compiling CB Trunk against wxWidgets 3.0.2.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline nikel

  • Single posting newcomer
  • *
  • Posts: 5
Re: Need help with code::blocks and gtk
« Reply #2 on: July 11, 2017, 05:59:49 pm »
Thanks for the quick reply. No I don't think so. I just tried

Code: [Select]
sudo apt-get install gtk-devel
but I got error:

Quote
E: Unable to locate package gtk-devel

Offline nikel

  • Single posting newcomer
  • *
  • Posts: 5
Re: Need help with code::blocks and gtk
« Reply #3 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?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 5899
    • My Best Post
Re: Need help with code::blocks and gtk
« Reply #4 on: July 11, 2017, 07:23:50 pm »
POST A BUILD LOG!
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Testing, compiling CB Trunk against wxWidgets 3.0.2.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 5899
    • My Best Post
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Testing, compiling CB Trunk against wxWidgets 3.0.2.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 5899
    • My Best Post
Re: Need help with code::blocks and gtk
« Reply #6 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.

C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Testing, compiling CB Trunk against wxWidgets 3.0.2.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline nikel

  • Single posting newcomer
  • *
  • Posts: 5
Re: Build log
« Reply #7 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))

Offline BlueHazzard

  • Lives here!
  • ****
  • Posts: 1466
Re: Need help with code::blocks and gtk
« Reply #8 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?

Offline nikel

  • Single posting newcomer
  • *
  • Posts: 5
Re: Need help with code::blocks and gtk
« Reply #9 on: July 12, 2017, 02:07:58 am »
I created it via gtk project wizard. I'm trying to build c project.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 4942
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Need help with code::blocks and gtk
« Reply #10 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.
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.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7200
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Need help with code::blocks and gtk
« Reply #11 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.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7200
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Need help with code::blocks and gtk
« Reply #12 on: July 13, 2017, 06:34:06 am »
Thanks for the quick reply. No I don't think so. I just tried

Code: [Select]
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.