LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-18-2016, 10:47 AM   #1
leprechaun3
LQ Newbie
 
Registered: May 2016
Posts: 20

Rep: Reputation: Disabled
GTK not working in Codeblocks


This is with a fresh install of Codeblocks from apt on linux mint 17.3. I did make sure to install libgtk-3-dev and I already tried following this suggestion, which is the only other suggestion I have been able to find. I am still getting the "gtk/gtk.h: No such file or directory" error. This is just with trying to compile the "Hello World" program that Codeblocks loads for a new GTK+ project.
 
Old 07-18-2016, 01:50 PM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,517

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Example, using gtk2 :
Code:
gcc -Wall -g helloworld.c -o helloworld `pkg-config --cflags gtk+-2.0` \
`pkg-config --libs gtk+-2.0`
gtk3
Code:
gcc -Wall -g helloworld.c -o helloworld `pkg-config --cflags gtk+-3.0` \
`pkg-config --libs gtk+-3.0`
 
Old 07-18-2016, 01:57 PM   #3
leprechaun3
LQ Newbie
 
Registered: May 2016
Posts: 20

Original Poster
Rep: Reputation: Disabled
I'm a little confused with your suggestion. Are you suggesting that I compile the program from terminal rather than using Codeblocks to compile the program? Or should I be inputting the code you gave me into Codeblocks somewhere so that Codeblocks will compile it? If the latter, where should I be adding the code?
 
Old 07-18-2016, 02:14 PM   #4
Mitt Green
Member
 
Registered: May 2014
Location: Europe
Posts: 199

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by leprechaun3 View Post
I'm a little confused with your suggestion. Are you suggesting that I compile the program from terminal rather than using Codeblocks to compile the program? Or should I be inputting the code you gave me into Codeblocks somewhere so that Codeblocks will compile it? If the latter, where should I be adding the code?
I am not sure about Code::Blocks (I've never used it either), but you certainly can compile it in terminal.

In the IDE you probably can put these options somewhere, where you click "compile" or "build".
 
Old 07-18-2016, 02:15 PM   #5
Mitt Green
Member
 
Registered: May 2014
Location: Europe
Posts: 199

Rep: Reputation: 116Reputation: 116
Anjuta is made specifically to develop GTK+ programmes.
 
Old 07-18-2016, 02:31 PM   #6
leprechaun3
LQ Newbie
 
Registered: May 2016
Posts: 20

Original Poster
Rep: Reputation: Disabled
The link in my original post suggests placing those commands in Codeblocks, but that did not work for me. The person that made that suggestion also said that Anjuta is not nearly as polished as Codeblocks, but maybe I'll try it if I can't get Codeblocks to work.
 
Old 07-18-2016, 02:35 PM   #7
Mitt Green
Member
 
Registered: May 2014
Location: Europe
Posts: 199

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by leprechaun3 View Post
The link in my original post suggests placing those commands in Codeblocks, but that did not work for me. The person that made that suggestion also said that Anjuta is not nearly as polished as Codeblocks, but maybe I'll try it if I can't get Codeblocks to work.
I tried a couple of years ago and it was okay. It's one of two IDEs I've tried though, the other being Geany.

Mmmaybe, you forgot to apply the settings?
 
Old 07-18-2016, 02:42 PM   #8
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,627

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
the issue with ""gtk/gtk.h:" is that it is dependant on gtk2 or 3 and you have to spiffy what one is used
/usr/include/gtk+-3/gtk/gtk.h
/usr/include/gtk+-3/gdk
and
/usr/include/gtk+-2/gtk/gtk.h
/usr/include/gtk+-2/gdk

hence the use of the `pkg-config --libs gtk+-3.0` pointer

this is even worse when the older gtk1 code tossed into the mix
 
Old 07-19-2016, 01:37 AM   #9
leprechaun3
LQ Newbie
 
Registered: May 2016
Posts: 20

Original Poster
Rep: Reputation: Disabled
Sometimes I hate computers. I just tried putting them in again and this time it worked. I really don't know what I did differently since before I even tried using copy/paste to make sure I wasn't mistyping it. I guess I did something equivalent to "turning it off and back on again."
 
Old 07-19-2016, 04:09 AM   #10
Mitt Green
Member
 
Registered: May 2014
Location: Europe
Posts: 199

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by leprechaun3 View Post
Sometimes I hate computers. I just tried putting them in again and this time it worked. I really don't know what I did differently since before I even tried using copy/paste to make sure I wasn't mistyping it. I guess I did something equivalent to "turning it off and back on again."
Big deal, it happens to many, if not all, of us
 
Old 07-19-2016, 06:55 AM   #11
briselec
Member
 
Registered: Jun 2013
Location: Ipswich, Australia
Distribution: Slackware
Posts: 74

Rep: Reputation: Disabled
Try placing them in Project > Build Options
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Codeblocks problem brodo Slackware 11 10-11-2015 07:33 AM
[SOLVED] codeblocks-13.12 is not installing rahulvishwakarma Linux - Software 2 07-09-2014 06:34 AM
CodeBlocks problem r_jr Linux - Software 1 04-29-2012 02:46 AM
Error in CodeBlocks sujitkulkarni Programming 2 03-16-2011 05:55 PM
codeblocks elishac Linux - Newbie 9 03-25-2010 04:06 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration