C/C++ Development in Puppy Linux

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
User avatar
Wosh
Posts: 60
Joined: Mon 09 Jul 2007, 19:20
Location: Nuremberg Germany

C/C++ Development in Puppy Linux

#1 Post by Wosh »

Hi folks

I would would like to do some C/C++ Development in Puppy-Linux integrating Glade/Gtk+, but I haven't found an IDE running smoothly with Puppy Linux.

My search within the web leads to Anjuta. But it seems to need the Gnome libraries. Has any body tried to make it run?

Or should we try to make this or another IDE run for Puppy Linux within this thread together?

Please report your experiences.
Last edited by Wosh on Sat 03 May 2008, 07:05, edited 1 time in total.
Wosh

User avatar
tronkel
Posts: 1116
Joined: Fri 30 Sep 2005, 11:27
Location: Vienna Austria
Contact:

#2 Post by tronkel »

You should have a look at C++ programming using FLTK.

It includes a GUI builder called Fluid and operates seamlessly with c/c++ and the STL libraries. It is small and fast as well. Ideal for use in Puppy.

I once made a dotpet of this.

http://www.dotpups.de/dotpups/Programming/

You'll certainly need some help to get started, but it's not difficult at all.

Google for "ercol" and see what comes up. That guy did a great series of demos for FLTK that I found invaluable.
Life is too short to spend it in front of a computer

ARAN
Posts: 113
Joined: Fri 21 Oct 2005, 12:47

Compiling Anjuta from sources

#3 Post by ARAN »

A very easy HOWTO for compiling ANJUTA from sources can you find here !

http://groups.google.com/group/anjuta/w ... -on-ubuntu

User avatar
Wosh
Posts: 60
Joined: Mon 09 Jul 2007, 19:20
Location: Nuremberg Germany

Gtk+ Applications written in C/C++

#4 Post by Wosh »

Hi tronkel

ercol leads to a furniture manufacturer

Hi ARAN

thanks for your hints for Anjuta, if noone other has come further yet I will try to compile Anjuta from the scratch.

But I want to explain a little bit better what I want to do and why I want it to do:

From my experience there is no easy way to write Gtk+ applications in Puppy Linux.
The alternatives are:

1. Shell scripts using gtkdialog (for me very cryptic hard to understand, forced to use cryptic tools like sed, awk to manipulate texts, very limited in variable handling).

2. Puppy Basic (easy to understand, but rather limited for complex jobs).

3. TCL/TK (no experience on my part).

So even that guys like Sigbert do great jobs using these languages, they are all interpreters which will fail if it comes to complex or time critical demands.

So what I want to do:
I have downloaded the Puppy-Linux-3.99 Development Version integrating Glade, which enables a very easy way to build Gtk+ user interfaces. But the coding of the callback functions has been removed from new versions of Glade.

What I have found out, is that IDEs like Anjuta seem to have an Integration of Glade and the supporting libraries like libglade or Gtkmm. Am I right?
What do I have to do to code Gtk+ Applications in C/C++ integrating tools like Glade?
Is anybody further than me?
Wosh

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#5 Post by BarryK »

Have a look at the menu in Puppy "Menu -> Help -> Howto program for Puppy".

One interesting possibility is to use Glade with FreeBASIC. There is a tool that will generate a skeleton FreeBASIC program to use a particular Glade file. This is in Puppy4, I don't recall if I put this info and tool in Puppy3.
[url]https://bkhome.org/news/[/url]

muggins
Posts: 6724
Joined: Fri 20 Jan 2006, 10:44
Location: hobart

#6 Post by muggins »

ercol leads to a furniture manufacturer
I think this is what Tronkel was referring to:

http://seriss.com/people/erco/fltk/

User avatar
Wosh
Posts: 60
Joined: Mon 09 Jul 2007, 19:20
Location: Nuremberg Germany

Plea for offering a C/C++ programming option in Puppy Linux

#7 Post by Wosh »

Hi muggins, hi tronkel
I have taken a closer look to Fltk/Fluid on http://seriss.com/people/erco/fltk/

Fluid is a GUI-Builder like Glade with the advantage to generate C-Code from the selected widgets.
Fltk is a platform-independant windows-library, but I am not shure whether it has been ported to Gtk+. Has someone more knowhow about that?
The video-tutorials on this page are excellent. So Fltk/Fluid could be a choice if it is possible to create Gtk+ applications, but they still require an IDE.

Hi BarryK
I already had read Menu/Help/How to program for Puppy but the but the choices offered there did not satisfy me enough. So as a professional software developer I am hoping that more Puppy developers want to create applications that are beyond the scope of these options fitting for simple applications but not for complex and optimized solutions.

Hi all
Maybe I still have not made clear what I am thinking about. So here is:

My plea for offering a C/C++ programming option in Puppy Linux

In my opinion the programming options to create Gtk+ programs in Puppy Linux are mediocre. Let explain my point of view:

1. Gtkdialog within a shell script
Even if gtkdialog has it's right for small applications like Pprocess it's limit is overstepped in applications like Pburn.
If you bother about taking a look into these scripts, you will see which mental acrobatics is necessary to get results:

a) Function results are stored in temporary files.
b) There is no simple way to create typed variables.
c) Lists are not supported.
d) The use of function parameters is limited.
e) Text manipulation is ineffective, hard to understand and only possible with the use of cryptic tools like sed, awk and cut.
f) The language itself is hard to understand. For me the only reason for it's existence is that very conservative point of view: "It has been in all Unix-Derivatives and so it must stay in all Unix-Derivatives until the Day of Judgment". It is a fossil that can be used for what it was developed: "The combination of skilled unix tools in a script".
g) Due to all these limits the performance of such a program must be lousy and can only be tolerated for applications where time doesn't play a role.
h) For those people that want to do even more chin-ups there is a good guide about shell scripts in:
http://tldp.org/LDP/abs/html/

What does it mean to use this language for complex applications:
I have to spend a lot of time to learn this language, I have to go into contortions to go around all it's traps. So a lot of my development time will be spent to find solutions for this language instead of the problem I am thinking about. It reminds me a little bit of the Stone Age of programming, when there
used to be guys that were able to read the machine code within the binaries laughing about people needing an Assembler to understand what is meant.

My result is:
To use the shell-script-language for complex applications, is same as to use a toothbrush for painting a wall. You will get interesting results that will be admired by a lover of this kind of art, but for the most purposes it is a waste of time.

So I on the one hand admire guys like Sigbert undertaking the punishment to create applications like Pburn as a gtkdialog-shell-script. On the other hand I think: "What a waste of time and talent. What could this guy reach with a reasonable Programming Language?"

What are the alternatives:

2. TCL/TK
TCL/TK is an interpreter to with all it's performance disadvantages

3. Puppybasic
Except of being an interpreter to puppybasic which is simple to understand only can be used for simple solutions.

4. Freebasic
Even if the programs created may be compiled and the guys developing the language may have solutions for complex purposes, it is still Basic and won't reach the possibilities of a C-Program

5. C/C++
I have programmed for about 20 years in different programming languages reaching from several kinds of assembler up to SQL but my favorite is still C/C++.

Why? If you are not accustomed to it C may be is cryptic as shell scripts are for me. Pascal is a lot nicer and leads to similar results. But C enables me to create solutions ranging from close to assembler up to GUI with a minimum of key typing effort.
So C for me is the English of Programming, universal in its purpose, rather easy to understand and quite fast to code. And it is no accident that even about 90% of the programs in Linux have been coded in C/C++.

What really makes me wonder is that a seem to be the only one seeing the need to a C/C++ IDE in Puppy Linux. So I especially ask the Puppy Linux developers:

How do you want to create a small and effective Linux distribution, if you avoid using the tools that enable you to create such kind of programs?
Has the C-development package sunk so low that it is used only to compile third part applications?
Who else sees the need to have a good C/C++ IDE in Puppy Linux?
Wosh

muggins
Posts: 6724
Joined: Fri 20 Jan 2006, 10:44
Location: hobart

#8 Post by muggins »

Who else sees the need to have a good C/C++ IDE in Puppy Linux?
Hello Wosh,

which are the good c/c++ IDE's? Anjuta has gnome dependencies. How minimal these are I'm not sure. I had a look at Crow Designer, but couldn't get it to compile on the latest puppy due to a glib incompatibility!

You might want to check this out:

http://enveria.sourceforge.net/

They have quite a nice gtk tutorial available as a .pdf download. And the Ide compiles easily, although I don't know how stable it is.

Regarding Fltk, it's a different graphics toolkit to gtk+. I'm not sure whether a gtk wrapper is available for it or not.

If you like programming in c/c++ then gtk isn't your only graphics option. You've also got QT, fltk & wx toolkits. For the latter you can look at codeblocks or CodeLite.

The problem with CodeLite & CodeBlocks are they require the bulky wx-widgets. Likewise anjuta needs gnome-libs, and any qt-based IDE is going to require QT libs, (probably the bloated QT4).

Regarding Tcl/Tk as a graphics toolkit, while it's definitely interpreted, you can also interface it with c/c++, so that you can write any time critical parts, like loops & array processing, in c/c++. I keep meaning to get stuck into it myself!

Lastly, you might be interested in checking out JohnMurga's MurgaLua. While it's also based on an interpeted language, (Lua), it has bindings to the fltk toolkit, and it's also easy to interface lua with c/c++.


(I forgot to mention ultimate++)

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#9 Post by MU »

from the Glade readme:
About Glade-3
~~~~~~~~~~~~~

This version of Glade (Glade-3) is a complete rewrite of the original Glade codebase.

One of the main differnces from glade-2 is that C code generation has been removed from
glade-3: this has been done on purpose, since using generated code is deprecated; the preferred
way to use glade files is with libglade (if code generation is needed, this can be provided
as another tool or plugin, code generation is simply not a part of the glade-3 project).
http://glade.gnome.org/

Libglade:
http://www.jamesh.id.au/software/libglade/

I found no link for a tool, that can convert Glade 3 XML-files to C.
So you had to install Glade 2, if you need that, and also cannot find a tool.
Or look in the examples/docs of Glade, how libglade is used.

I use libglade in GtkBasic, but this will not help you.
But maybe I can explain the basic concept.
It works like this:
Whenever an event occurs, it is connected to the function "signal_handler".

Here is the relevant code from the Interpreter:

Code: Select all

 void connections(GladeXML *xml){
	/*connect all widgets event*/
	GList* allwidgets=NULL;
	GtkWidget *widget;
	
	allwidgets = glade_xml_get_widget_prefix(xml, "");
	
	while (allwidgets != NULL) {
		g_signal_connect (G_OBJECT (allwidgets->data), "event", G_CALLBACK (signal_handler), NULL);
		allwidgets = allwidgets->next;
	}
	
	g_list_free(allwidgets);

}


int loadXMLFile(char *file){
	//printf("---%s\n" , file);
	removeNL(file);
	//gdk_threads_enter();
	/* load the interface */
	xml = glade_xml_new(file, NULL, NULL);
	//gdk_threads_leave();
	if (xml==NULL) return -1;
	connections(xml);
	return 0;
}
I took this code from "gins", it is short, and very helpfull to see, how libglade can be used.
http://freeweb.lombardiacom.it/kirsoft/gins.html

Here are some lines from the function "signal_handler":

Code: Select all

//-- Main Event-handler --
gboolean signal_handler(GtkWidget *widget, GdkEvent* event, gpointer data) {

}
I just show it, so that you can see, what parameters it uses.
The part in the function will not help you, as in GtkBasic this is very specific using an own datatype "variant" (inherited from wxBasic).
So I don't post it here.
But you can see, that this function receives all you need, to write conditions, that do specific things on certain widgets or events.

The gins sourcecode will be more interesting for you.

I write GtkBasic using leafpad, and compile it with a simple makefile that just runs gcc , so I cannot recommend an IDE.
Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#10 Post by MU »

[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#11 Post by MU »

[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
Wosh
Posts: 60
Joined: Mon 09 Jul 2007, 19:20
Location: Nuremberg Germany

Gtk+ C/C++ Package

#12 Post by Wosh »

Hi muggins
Thanks for your reply. Your hints about the IDEs are very useful. Did you try to compile Enveria for Puppy Linux?

Hi MU
Thanks for your links. Especially
http://www.gnome.org/~newren/tutorials/ ... nome/html/
offers a lot of useful information.
Glade-2 does not seem to be a serious alternative to Glade-3 because it seems not to be supported any more. Maybe it can be used as an generator for callback functions for libglade. I will see. I am wondering a little bit why the automatic code generation was removed from Glade without supplying a better alternative (now the code generation must be done manually).

Hi folks

Gtk+ C/C++ Package

It seems that up to now no one has coded Gtk+ C/C++ programs in Puppy Linux due to the lack of appropriate tools.

So my target is to create a PET-package or an sfs-file (if it becomes to extensive) containing all the tools and information necessary for easy Gtk+ C/C++ programing.

It seems, there doesn't exist an IDE for Puppy because the default Linux-IDEs need libraries that are not part of the Puppy-Linux distribution. We have:

Anjuta (gnome dependencies, Glade integration)
Crow Designer (not supported any more)
Codeblocks (wxWidget dependencies)
CodeLite (wxWidget dependencies)
Enveria (RAD-IDE especially for Gtk+)

From these alternatives especially Enveria with it's Gtk+ integration and Anjuta with it's Glade integration are very promising.

Does anybody know whether it will be possible to compile and run Anjuta without the installation of gnome?
Is there anybody out there who has an IDE working with Puppy Linux?
Wosh

User avatar
SirDuncan
Posts: 829
Joined: Sat 09 Dec 2006, 20:35
Location: Ohio, USA
Contact:

#13 Post by SirDuncan »

I did have Anjuta almost working at one point, but I kept getting some error that did not seem to have anything to do with dependencies (I think it may have been something about locale not supported). I didn't really have the motivation to figure it out. I think I still have all the libs archived somewhere, so I will post them once I have found them. Maybe you will be able to get it working.

I would probably have worked harder on getting it working, but I have no pressing need to write GUIs since all of the assignments for class are still CLI.

EDIT: Found them. At least I think this is all of them. I actually had more than one folder named anjuta, but I think this is from the one that was close to working. I temporarily hosted them on my university webspace, but it's not really intended for file hosting so I won't leave them there for long.
SECOND EDIT: Mark has mirrored the files, so I have removed them from my webspace. They can now be found at:
http://dotpups.de/puppy3/dotpups/Progra ... uta-2.3.1/
Last edited by SirDuncan on Tue 06 May 2008, 23:02, edited 2 times in total.
Be brave that God may help thee, speak the truth even if it leads to death, and safeguard the helpless. - A knight's oath

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#14 Post by MU »

SirDuncan
I can mirror the files.
In which Puppy version did you create them?
Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
SirDuncan
Posts: 829
Joined: Sat 09 Dec 2006, 20:35
Location: Ohio, USA
Contact:

#15 Post by SirDuncan »

I think it was in 3.01, because I remember using Slackware binaries for some of the packages.
Be brave that God may help thee, speak the truth even if it leads to death, and safeguard the helpless. - A knight's oath

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#16 Post by MU »

thanks, mirrored here:
http://dotpups.de/puppy3/dotpups/Progra ... uta-2.3.1/
http://puppyfiles.ca/dotpupsde/puppy3/d ... uta-2.3.1/
I did not check, if they uploaded correctly, as I'm very tired and must sleep soon.
Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
Wosh
Posts: 60
Joined: Mon 09 Jul 2007, 19:20
Location: Nuremberg Germany

Anjuta running with Puppy 4.00

#17 Post by Wosh »

Hi Sir Duncan
Thanks for putting together all these pets necessary to run Anjuta.

Hi Mark
Thanks for mirroring Anjuta. I have installed all pets without problem from http://dotpups.de/puppy3/dotpups/Progra ... juta-2.3.1

Hi all
I have succeeded to install Anjuta in Puppy Linux 4.00 and it even starts with localized version by default. There was some fine tuning necessary, but at the first glance everything looks ok. That's how I proceeded:

Installation of Anjuta in Puppy Linux 4.00
1. Install all pets from http://dotpups.de/puppy3/dotpups/Progra ... uta-2.3.1/
2. Install libattr from ftp://ibiblio.org/pub/linux/distributio ... 2.4.32.pet
3. Install libacl from ftp://ibiblio.org/pub/linux/distributio ... 2.39_1.pet
4. Install dotpuphandler-0.0.4-2 with the Petget-package-manager from Official-Puppy4
5. Install libfam from http://dotpups.de/dotpups/Libraries/Libfam0.0.0.pup

Reedited Start
Warning!!!
Anjuta is not stable yet.
The second glance was rather bad:
1. It starts with an error message: "Can not open "-0,214900".
2. It can not find scintilla for editing (I thought geany is build with scintilla, so it should be installed in Puppy Linux).
3. It crashes if you try to load a C-file and requires bug-buddy for bug reporting.
4. The same crash happens if you enter Edit/Preferences
Result: You can not work with Anjuta yet!

I have tried to install bug-buddy from a debian-package, but I have failed. Anjuta still complains about bug-buddy.
I will need help of a more sophisticated Linux user!
Reedited end

Even everything seems to look good right now, I am thinking about making the Anjuta installation more easy for people interested in C/C++ programming. I am not a PUP/PET expert at all so maybe Mark or someone else can help me:

Simplification of Anjuta Installation
1. All files necessary should be loaded in one installation step, so as long as Barry can not be convinced to mirror Anjuta maybe Mark could move the additional packages to his mirror.
2. Libfam0.0.0.pup should be converted to a PET that the installation of the dotpuphandler isn't necessary any more.
3. The installation process should find the dependent packages automatically like the paket-manager does with the default packages.
4. It could a useful option to move the IDE to an sfs-file, but I am not shure whether the libraries there would clash with libraries installed otherwise.

So far

Happy coding
Wosh

ARAN
Posts: 113
Joined: Fri 21 Oct 2005, 12:47

#18 Post by ARAN »

Anjuta should work bugfree !
For me the bugs look like they were the result of missing dependency.

I suggest you to go to the anjuta irc channel and to talk to trentg or naba kumar the maintainer.

They can give you a lot of helpfull and usefull Tips how to compile anjuta bugfree from scratch in puppy linux 4.0

I itslef needed only 45 minutes with the help of the irc chat to compile anjuta from scratch the first time.

It would be not bad if you could provide a simple step by step howto for compiling anjuta from scratch in puppy linux so other people have the chance the next time to do it the same way.

irc://irc.gnome.org/anjuta

User avatar
Wosh
Posts: 60
Joined: Mon 09 Jul 2007, 19:20
Location: Nuremberg Germany

Compilation of Anjuta 2.4.0

#19 Post by Wosh »

@ ARAN
It's quite clear that dependencies are missing but the question is which ones. I haven't succeeded to install bug-buddy, maybe strace or ltrace could help. Because SirDuncan's Anjuta version is a bit outdated I will not pursue this way further.
I want to try to recompile Anjuta but the compilation won't be done within your suggested 45 minutes because Puppy is lacking a lot of gnome packages compared to fully-grown distributions.

@ All
Compilation of Anjuta 2.4.0
I want to try to do a new compilation of Anjuta using the newest stable version 2.4.0.
The first problem I have encountered compiling from the scratch is the installation target.
A lot of packages tend to install their libraries to /usr/local/lib.
In Puppy most of the libraries rest in /usr/lib.

If you install to /usr/local/lib configure of some packages will complain because pkg-config can not find the library-version.
The reason is: In Puppy PKG_CONFIG_PATH is set to /usr/lib/pkgconfig and not to /usr/local/lib/pkgconfig.

Would it be better to adjust PKG_CONFIG_PATH and install to /usr/local/lib or to install all packages to /usr/lib?
Is there a installation guideline in Puppy Linux?
Wosh

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#20 Post by MU »

./configure --prefix=/usr

I compile everything like this, except teststuff, that goes to testfolders. But in that case, I also must write startscripts, that set PATH and LD_LIBRARY_PATH. So the latter is usually not recommended.
Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

Post Reply