Learning C: getting Devx and what do I do next? (Solved!)

Issues and / or general discussion relating to Puppy

Moderator: Forum moderators

User avatar
cobaka
Posts: 565
Joined: Thu Jul 16, 2020 6:04 am
Location: Central Coast, NSW - au
Has thanked: 89 times
Been thanked: 61 times

Learning C: getting Devx and what do I do next? (Solved!)

Post by cobaka »

G'day all:

I'm trying to understand (and do) the process of learning/compiling/running a C program.
I'm on the way; but a gentle nudge to my compass will help.
Below - rockedge provided the link to Devx I wanted: http://distro.ibiblio.org/puppylinux/pu ... _19.03.sfs

Some words will help understand what I wrote (below). <I believe> == I'm uncertain abt a particular fact.

I believe the tool I need (in Puppy) is called Devx. (yes/no?) u/c "D" y/n?
I arrived at this conclusion by reading:
Link: http://wikka.puppylinux.com/devx (and then here)
Link: http://distro.ibiblio.org/puppylinux/

I'm run uPupBB (the busy beaver): Distro: BionicPup32 19.03 (thank god for PupSysInfo!)
I go to the sub-directory on the link above:
Link: http://distro.ibiblio.org/puppylinux/puppy-bionic/ (I'm looking for Devx, right? - y/n?)
Nothing/nada/zip. I'm in the wrong place!

So I look at Puppy Pets by navigating ../ (up the to ...)
Link: http://distro.ibiblio.org/puppylinux/pe ... es-upupbb/ (I'm looking at puppy pets here ...)
Lots of stuff in that directory but no Devx. I'm looking for Devx, right? y/n?

At this point I know my journey into C will be faster if I post this on the forum. (Shouting! Devx!! Where are you?)
Help, please!

cobaka

PS. I want to learn "C" and compile some source code. In Puppy. I know where the source I want to compile lives .... I don't have to worry about that ....

From PupSysInfo: I advise about my CPU. Intel(R) Core(TM) i5-2500 CPU @ 3.30GHz
My version of Puppy: Distro: BionicPup32 19.03
Yes, yes, I know. I'm running a 32 bit version on a 64 bit machine, but hey! it's working! That's all I need ...

Last edited by cobaka on Wed Aug 18, 2021 1:41 am, edited 2 times in total.

собака --> это Русский --> a dog
"c" -- say "s" - as in "see" or "scent" or "sob".

User avatar
rockedge
Site Admin
Posts: 6407
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 2617 times
Been thanked: 2556 times
Contact:

Re: Learning C: getting Devx and what do I do next?

Post by rockedge »

the correct one is here -> http://distro.ibiblio.org/puppylinux/pu ... _19.03.sfs

Load it using Menu->Setup->SFS-Load-on-the-fly

There are some examples also around the forum of using some C to make tray icons that is a start.

This is pretty cool and I modified it to work as a X10 switch for lamp controllers
viewtopic.php?f=157&t=1362

User avatar
mikewalsh
Moderator
Posts: 6047
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 746 times
Been thanked: 1912 times

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by mikewalsh »

@cobaka :-

Les:-

Typically, the Devx should live in /mnt/home (you may have it as /initrd/mnt/dev_save; some Pups do this, others don't. Which CAN be confusing!) In other words, alongside all the Puppy .sfs files and your Pup-save, OK?

When you want to use it, simply click on it to load it. Or, as rockedge says, use rt-click->SFS load-on-the-fly).

When you've finished your compiling, you can then unload it, again by either clicking on it, and follow the prompts, or by rt-clicking->SFS load-on-the-fly. (You may wish to leave it permanently loaded. Some folks do; it doesn't hurt anything.)

Have fun!

Mike. ;)

User avatar
April
Posts: 493
Joined: Tue Dec 29, 2020 9:06 pm
Has thanked: 57 times
Been thanked: 28 times

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by April »

I would also add if you go to arduino.cc , find the download page and download the latest IDE.

It uses C to program bits and pieces and has a massive library of examples which come down with it so everything just works . Variables ,arrays, objects etc.

Point being ,its an easy way to pick up the basics of C and maybe make a few things too so its not just dry C.

The Australian State Governments have all enacted laws to steal your assets on your death. All legal paperwork is binned and all assets seized on one disgruntled child's complaint.Move them well before you die or go into a home.

User avatar
Jafadmin
Posts: 384
Joined: Tue Aug 04, 2020 4:51 pm
Has thanked: 68 times
Been thanked: 85 times

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by Jafadmin »

April wrote: Sat Aug 21, 2021 6:44 am

I would also add if you go to arduino.cc , find the download page and download the latest IDE.

It uses C to program bits and pieces and has a massive library of examples which come down with it so everything just works . Variables ,arrays, objects etc.

Point being ,its an easy way to pick up the basics of C and maybe make a few things too so its not just dry C.

All true except for two things; Arduino Language is not C, and you can't pick up the basics of C using Arduino Language.
;)
Arduino Language is one of the "C like" languages in that it shares some of the syntax standards of C/C++. Other "C like" languages include C#, Java, PHP, D, Perl, etc ..

User avatar
April
Posts: 493
Joined: Tue Dec 29, 2020 9:06 pm
Has thanked: 57 times
Been thanked: 28 times

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by April »

Jafadmin wrote: Sun Aug 22, 2021 12:02 pm

All true except for two things; Arduino Language is not C, and you can't pick up the basics of C using Arduino Language.
Arduino Language is one of the "C like" languages in that it shares some of the syntax standards of C/C++. Other "C like" languages include C#, Java, PHP, D, Perl, etc ..

Well your detail is correct except I learnt "C" from it .

The use of variables , Constants Data Types instances ,classes if you prefer Communication , programming technique ,output ,array structures ,strings,Bits and Bytes Random Numbers Variable Scope & Qualifiers Conversion Math Interrupts etc etc.
So I don't see how you can say you can't learn from it . Maybe you have not realised you can use modules in it too.

Computer programming is a technique to get the machine code to do what you want it to do . There are a multitude of languages that will get you there . personally I started with a basic CADOL language in 1974 and some 8080 machine coding, the usual basics , a bit of cobol when I went to uni ,a bit of java back when it was 2 or something getting out enterprise rubbish ,and then uni used a language I can't even remember -Pascal-in 1991.studying "D" later was just a waste of time.Perl I didn't like but its powerful like Python.

Java was a disaster . 2 big books written by women who organised it like their kitchen utensil draws.Bloody nightmare.

I've done a bit of it but I see arduino as an interesting way to get in and get started with some basics ,regardless of what you think.

The Australian State Governments have all enacted laws to steal your assets on your death. All legal paperwork is binned and all assets seized on one disgruntled child's complaint.Move them well before you die or go into a home.

User avatar
rockedge
Site Admin
Posts: 6407
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 2617 times
Been thanked: 2556 times
Contact:

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by rockedge »

@April I also learned to code in every language I know through BASIC. I agree fully it is the structures and principles that one learns from that first programming that apply across all the languages. One sure can learn C through using the Arduino Language and probably move right on over to PHP, PERL and PYTHON as well!

Let us know what kind of projects you come up with.

User avatar
Jafadmin
Posts: 384
Joined: Tue Aug 04, 2020 4:51 pm
Has thanked: 68 times
Been thanked: 85 times

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by Jafadmin »

Jesus, you guys! :roll: :lol: :lol: :lol: That's like saying you can learn to peel apples using an orange.

You can't even do console I/O with Arduino Language. You do realize that, right?

Arduino Language is great for programming Arduinos.

Here: https://www.tutorialspoint.com/cprogramming/index.htm

User avatar
wiak
Posts: 4036
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 62 times
Been thanked: 1176 times
Contact:

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by wiak »

I've been programming in C for thirty years (and a little C++). I was also an electronics engineer, interfacing to various microprocessor controlled circuit boards (way back before then with Z80, 8080, 8051 assembly code - and have, back in about 1990, written (in mix of 8086 assembler and C) protocol analyser that real-time captured/analysed TCP/IP coming over a satellite link). Arduino looks great to me - you can probably learn more as an engineer programming that than programming Rasp PI (which is pretty much a full-fledged little computer). I recognise the Arduino language as C, as would any C programmer (a subset with some C++ thrown in). So I entirely agree with the following:

https://arduino.stackexchange.com/quest ... nguage/824

it is basically a simplification of C/C++ (you can practically copy&paste arduino code to a C/C++ file, and it will work). Also it makes sense that you can go and use a full well known IDE as eclipse:

But most of all, as far as this thread is concerned, I cannot understand why there are any negative comments about learning some C from working with an Arduino, which is surely an excellent way to do it. Personally, I keep meaning to purchase an Arduino (and a Raspberry Pi of some sort). Programming in C is so pleasant compared to handling interrupts and stacks and indirect calls to tables in any assembly language! But main thing is that programming the likes of an Arduino is a great learning experience - you can use an IDE on your PC and cross-compile for the Arduino. I haven't checked but I expect you can get software simulations of Arduino (almost surely) - so you don't even then need the hardware if you don't have any LEDs or motors or whatever you want to physically control. Overall, you can learn far more about the core operation of a computer system via the likes of an Arduino than a Puppy PC - but of course Linux system programming is itself a whole different ballgame. You might prefer to learn that instead, or not care at all about system-level programming and prefer learning something that allows you to quickly build apps for your PC - then C/C++ can become a bit painful - hence the popularity of the likes of Python along with something like Kivy to make the GUI implementation almost simple and pleasant.

But if you like electronics or robotics, or simply want to make some sort of control unit for something or other, then an Arduino would be a great choice (and teach you a bit C in the process). Hope you've found your devx cobaka! I don't use any devx, I always have the compilers and so on I want permanently installed on my own system - saves me having to load any sfs if I suddenly want to compile a bit code.

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

User avatar
Jafadmin
Posts: 384
Joined: Tue Aug 04, 2020 4:51 pm
Has thanked: 68 times
Been thanked: 85 times

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by Jafadmin »

Ok, you guys are officially whackadoodle! :lol: :lol: :lol:

Arduino Language has no main() function. Instead it has two mandatory functions called setup() & loop(). setup() calls loop() although not explicitly. It just hauls off and does it just for grins. loop() (which is mandatory) does exactly what it's name implies; it friggin' loops. It doesn't conditionally loop. Nope. It just loops.

NONE of the above MANDATORY elements which are required to start an Arduino sketch exists in C/C++.

If this following statement does NOT resonate with you, you are not going to be a C/C++ programmer:

IF you want to learn C, learn from a C source, not from an orange peeling source. https://www.tutorialspoint.com/cprogramming/index.htm

(Christ on a crunchy crosswalk!?!) :shock:

User avatar
Jafadmin
Posts: 384
Joined: Tue Aug 04, 2020 4:51 pm
Has thanked: 68 times
Been thanked: 85 times

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by Jafadmin »

The following is an example of why arduino language is not C. This creates a filter you can put in '/root/my-applications/bin' that will strip all non-ascii (unix txt) characters from a file for you:

Code: Select all

/* asciify.c	gcc -o asciify asciify.c
 * A filter that strips non-ascii content from a file 
 * 
 * 	Usage: cat filename.ext | asciify > newname.out
 *
 * gcc asciify.c -o asciify 
*/
#include <stdio.h>

#define SPACE_CHAR 	32	// Space character
#define END_CHAR	127	// End of 7-bit ascii

int main(void)
{
 	int ch;  

	while( (ch=getchar()) != EOF ) // Get bytes from stdin
	{
		// send keepers to stdout ..
		if(ch==9) putchar(ch); // Tab
		if(ch==10)putchar(ch); // Line feed
		if((ch >= SPACE_CHAR) && (ch < END_CHAR)) putchar(ch);
	}
}

C/C++ can access stdin & stdout. Not possible in arduino language. This C code will work exactly the same on all OS's with a C compiler.

FYI: This handy util will convert MS txt files to Unix/Linux txt files :thumbup2:

User avatar
April
Posts: 493
Joined: Tue Dec 29, 2020 9:06 pm
Has thanked: 57 times
Been thanked: 28 times

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by April »

Don't use MS text ever and you are being pedantic.

You can't even do console I/O with Arduino Language. You do realize that, right?

Arduino uses a serial terminal and its sufficient for all the communication you need with a chip, keeping in mind you are putting a program on a chip that will run autonomously .

Its not C++ or any specific breed of "C" but its always interesting and gives a huge sense of achievement to make a few LED's flash or turn on a light somewhere in the world that you are not. There is a huge amount of fun and learning in there .

The Australian State Governments have all enacted laws to steal your assets on your death. All legal paperwork is binned and all assets seized on one disgruntled child's complaint.Move them well before you die or go into a home.

User avatar
Jafadmin
Posts: 384
Joined: Tue Aug 04, 2020 4:51 pm
Has thanked: 68 times
Been thanked: 85 times

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by Jafadmin »

April wrote: Tue Aug 24, 2021 9:32 pm

.. and you are being pedantic.

Mea culpa .. ALL software engineers are "pedantic", April. That's what them there "duhgrees" is all about. :roll:

Now go explain to OP how to use C to make a "Hello World" GUI app. Seriously.
He's going to want to know that :thumbup:

User avatar
wiak
Posts: 4036
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 62 times
Been thanked: 1176 times
Contact:

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by wiak »

Jafadmin wrote: Tue Aug 24, 2021 2:03 pm

Ok, you guys are officially whackadoodle! :lol: :lol: :lol:

Arduino Language has no main() function. Instead it has two mandatory functions called setup() & loop(). setup() calls loop() although not explicitly. It just hauls off and does it just for grins. loop() (which is mandatory) does exactly what it's name implies; it friggin' loops. It doesn't conditionally loop. Nope. It just loops.

NONE of the above MANDATORY elements which are required to start an Arduino sketch exists in C/C++.

If this following statement does NOT resonate with you, you are not going to be a C/C++ programmer:
... [blah blah blah]

That's such a minor detail - you can easily enough add int main (int argc, char *argv[]) to your more generic C knowledge later...

Great thing is that this topic led me to some nice online Arduino simulators:

https://www.tinkercad.com/
also see: https://www.programmingelectronics.com/ ... tinkercad/
https://wokwi.com/

Here is a simple example to turn LED on and off. Revolutionary!!!

https://www.arduino.cc/en/Tutorial/Buil ... ples/Blink

Code: Select all

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

User avatar
rockedge
Site Admin
Posts: 6407
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 2617 times
Been thanked: 2556 times
Contact:

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by rockedge »

I come from the era one turned an LED on and off using a TL55 clock chip wired in a flip flop circuit. LED was exotic and LCD not yet around. This chip was the latest greatest.
I never got a college or University degree. I light film sets and television studios and on occasion sport venues for live television. I'm a gaffer or in German an Oberbeleuchter.

I learned computer programming by looking over the shoulder of some really good ones in the 70's. And just trying it out and hacking at it until something worked. Why? because I always wanted to be a computer engineer and or programmer but circumstances put me on a different path.

You'd be surprised what skills translate into good computer programming.

User avatar
April
Posts: 493
Joined: Tue Dec 29, 2020 9:06 pm
Has thanked: 57 times
Been thanked: 28 times

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by April »

What uni does for you is forces a lot of knowledge into your head that you need to pass an exam on the subject .
Its so compressed that you don't get time to consider the ramnifications of what you are taught or question their accuracy.

Self learning is what you then have to do to make sense of it and that is whats called experience. They come out of uni thinking they know it all and sink down and realise they don't really know much at all. Bugger!

You can't beat teaching yourself.

The Australian State Governments have all enacted laws to steal your assets on your death. All legal paperwork is binned and all assets seized on one disgruntled child's complaint.Move them well before you die or go into a home.

User avatar
wiak
Posts: 4036
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 62 times
Been thanked: 1176 times
Contact:

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by wiak »

I would agree that I feel I didn't learn much in undergraduate engineering studies. I learned a lot at university later - but I wasn't doing any formal 'studies' then - it was all practical research, and I learned a lot from doing that. I actually was a very bad student during the undergraduate years - playing chess, table football, and sleeping till late in the afternoon (missing most lectures and photocopying notes like crazy just prior to exams) - I do not at all recommend that approach to university studies - I paid highly for that mistake for years thereafter and only recovered because an eccentric professor saw potential in me because of some stuff I did later in engineering practice - otherwise there was no chance I would have managed to get into that research group. When I much later returned to university for various odd reasons to study English, I took a more mature approach, and did well and did learn a lot - but still, practical work (including research, which mainly does involve self-taught reading and experimenting) is what really makes a person excel at any endeavour - and I do take the view that no-one needs a university degree to become the best at anything - what they need is enthusiasm and desire to learn and do (or implement) something - then anything is possible about anything for anyone. Alas you will still often be judged on the pieces of paper qualification you have managed to accumulate, which often mean really nothing at all...

Anyway, now that I am retired, I couldn't care less about qualifications - having them or not having them. I am not looking for work, nor need to impress anyone in order to find such. However, I encourage my children to do well regardless of the 'weakness' of the overall education systems that we all had to suffer to a greater or lesser extent.

EDIT: I should add that I think the biggest problem with university-led education is the 'academics' - all too often they have no interest in the basic undergraduate material they have to teach (preferring their own research activities) but also, very few of them indeed have learned from practical engineering experience - occasionally you might be fortunate to be taught by someone who learned his craft through actual practical experience in the industry (though depends if the person was a good engineer or one of the too many mediocre ones of course...) - then you may well be taught in a truly meaningful manner. I certainly needed some theories I learned at university in later engineering design/development jobs - Boolean algebra and Karnaugh maps were an essential for my later practical engineering life, as were Kirchoff's laws in analog circuitry design - but I only really became good at both of these when I found I needed them once working in industry. I went into tertiary teaching myself thereafter, and do think I was pretty good at that exactly because I was teaching from real life practical industrial application experience.

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

User avatar
April
Posts: 493
Joined: Tue Dec 29, 2020 9:06 pm
Has thanked: 57 times
Been thanked: 28 times

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by April »

rockedge wrote: Wed Aug 25, 2021 3:56 pm

I come from the era one turned an LED on and off using a TL55 clock chip wired in a flip flop circuit.

I'm thinking that might be a 555 timer , yeh?

The Australian State Governments have all enacted laws to steal your assets on your death. All legal paperwork is binned and all assets seized on one disgruntled child's complaint.Move them well before you die or go into a home.

User avatar
wiak
Posts: 4036
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 62 times
Been thanked: 1176 times
Contact:

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by wiak »

The best experiences (I feel) are less to do with the technological context though - more to do with the social environment and activities we were involved in. Hence I'd agree being a gaffer in film production is something to feel very good about. I couldn't care less myself about my technical activities or prowess actually - rather, I remember some of the crazy jobs and experiences I've had working in several African countries and being stuck in downtown Suva during their first military coup, both of which involved great excitement and sometimes danger, and living in Norway for a year (which started with the all too human 'chasing a woman I'd met' behaviour of youth, but ended by giving me knowledge of a different culture and language, which has remained fond in my memory for the many decades since). I'd give up all technology tomorrow and head off to watch the elephants any day if my current circumstances didn't in fact make a nonsense of that possible plan - maybe tomorrow...

Actually, truth to tell that 'eccentric professor' who invited me into his high-level research group didn't really do that because he cared about my engineering skills - rather, he was impressed by my Africa adventures and clear thirst for excitement - he basically told me he thought, because of that part of my nature I'd be an interesting addition to his research group (i.e. I was a bit of an experiment on his behalf maybe - fortunately I did have the engineering practical skills to justify his selection later). An open and adventurous mind is what research is all about I suppose - ability to think outside the box (and via lateral thinking) being the key 'qualification' sought after and personality traits can reveal a great deal about a person's potential. I feel fortunate also in that I was taught to play chess and introduced to electronics at the early age of five.

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

User avatar
rockedge
Site Admin
Posts: 6407
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 2617 times
Been thanked: 2556 times
Contact:

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by rockedge »

April wrote:

I'm thinking that might be a 555 timer

It sure is!!

User avatar
Jafadmin
Posts: 384
Joined: Tue Aug 04, 2020 4:51 pm
Has thanked: 68 times
Been thanked: 85 times

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by Jafadmin »

wiak wrote: Wed Aug 25, 2021 6:07 am

... [blah blah blah]

Here is a link to get started with gtk+ V2 for the OP: https://zetcode.com/gui/gtk2/firstprograms/

IIRC, the includes on puppy devx's goes like: #include <gtk-2.0/gtk/gtk.h>, and <gtk-3.0/gtk/gtk.h>
It may be necessary to use some symlinks to make the header path for gtk to work right. If you have problems with it, just ask.

User avatar
April
Posts: 493
Joined: Tue Dec 29, 2020 9:06 pm
Has thanked: 57 times
Been thanked: 28 times

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by April »

@Jafadmin
/* Print out "Hello World"
* by April
*/
void setup() {
//Initialize serial
Serial.begin(9600);
// prints title with ending line break
Serial.println("Hello World");
}

The Australian State Governments have all enacted laws to steal your assets on your death. All legal paperwork is binned and all assets seized on one disgruntled child's complaint.Move them well before you die or go into a home.

User avatar
wiak
Posts: 4036
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 62 times
Been thanked: 1176 times
Contact:

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by wiak »

Jafadmin wrote: Thu Aug 26, 2021 5:48 pm
wiak wrote: Wed Aug 25, 2021 6:07 am

... [blah blah blah]

Here is a link to get started with gtk+ V2 for the OP: https://zetcode.com/gui/gtk2/firstprograms/

IIRC, the includes on puppy devx's goes like: #include <gtk-2.0/gtk/gtk.h>, and <gtk-3.0/gtk/gtk.h>
It may be necessary to use some symlinks to make the header path for gtk to work right. If you have problems with it, just ask.

Thanks for giving me the get started link jafadmin. What is gtk? Does it actually work with Arduino?

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

User avatar
Jafadmin
Posts: 384
Joined: Tue Aug 04, 2020 4:51 pm
Has thanked: 68 times
Been thanked: 85 times

Re: Learning C: getting Devx and what do I do next?

Post by Jafadmin »

wiak wrote: Fri Aug 27, 2021 2:48 am

Thanks for giving me the get started link jafadmin. What is gtk? Does it actually work with Arduino?

What you do is resist the urge to derail the OP's topic. viewtopic.php?p=34351#p34351

User avatar
Jafadmin
Posts: 384
Joined: Tue Aug 04, 2020 4:51 pm
Has thanked: 68 times
Been thanked: 85 times

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by Jafadmin »

April wrote: Thu Aug 26, 2021 8:01 pm

@Jafadmin
/* Print out "Hello World"
* by April
*/
void setup() {
//Initialize serial
Serial.begin(9600);
// prints title with ending line break
Serial.println("Hello World");
}

QED .. (The only part of that post that is standard C is the comment lines.)
Reference: viewtopic.php?p=34351#p34351

User avatar
wiak
Posts: 4036
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 62 times
Been thanked: 1176 times
Contact:

Re: Learning C: getting Devx and what do I do next?

Post by wiak »

Jafadmin wrote: Fri Aug 27, 2021 2:31 pm
April wrote: Thu Aug 26, 2021 8:01 pm

@Jafadmin
/* Print out "Hello World"
* by April
*/
void setup() {
//Initialize serial
Serial.begin(9600);
// prints title with ending line break
Serial.println("Hello World");
}

QED .. (The only part of that post that is standard C is the comment lines.)
Reference: viewtopic.php?p=34351#p34351

That's all standard C/C++. It's perfectly normal in C to write your own library of functions and that is all the programmer has done (for Arduino). Whoever started the example of using Arduino (April I think) was simply giving a perfectly reasonable and interesting alternative way to get into C programming. Anyway, I can't be bothered arguing about its relevance or otherwise with someone stuck with one idea.

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

User avatar
Jafadmin
Posts: 384
Joined: Tue Aug 04, 2020 4:51 pm
Has thanked: 68 times
Been thanked: 85 times

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by Jafadmin »

wiak wrote: Fri Aug 27, 2021 2:36 pm

.. [blah, blah, blah]

Compiling GTK gui apps will require a compile command or makefile entry that looks something like one of these:

Code: Select all

	gcc -o MyApp.c -w `pkg-config --libs gtk+-3.0` `pkg-config --cflags gtk+-3.0` 
	gcc -o MyApp.c -w `pkg-config --libs gtk+-2.0` `pkg-config --cflags gtk+-2.0`
User avatar
wiak
Posts: 4036
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 62 times
Been thanked: 1176 times
Contact:

Re: Learning C: getting Devx and what do I do next?

Post by wiak »

Jafadmin wrote: Tue Aug 24, 2021 11:55 pm

Now go explain to OP how to use C to make a "Hello World" GUI app. Seriously.
He's going to want to know that :thumbup:

Code: Select all

#include <qapplication.h>
#include <qpushbutton.h>

int main( int argc, char **argv )
{
    QApplication a( argc, argv );

    QPushButton hello( "Hello world!", 0 );
    hello.resize( 100, 30 );

    a.setMainWidget( &hello );
    hello.show();
    return a.exec();
}

albeit C++, but then again GTK isn't exactly part of standard C reference either. Good to consider whether to use Qt or GTK+

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

User avatar
Jafadmin
Posts: 384
Joined: Tue Aug 04, 2020 4:51 pm
Has thanked: 68 times
Been thanked: 85 times

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by Jafadmin »

wiak wrote: Fri Aug 27, 2021 3:00 pm
Jafadmin wrote: Tue Aug 24, 2021 11:55 pm

Now go explain to OP how to use C to make a "Hello World" GUI app. Seriously.
He's going to want to know that :thumbup:

Code: Select all

#include <qapplication.h>
#include <qpushbutton.h>

int main( int argc, char **argv )
{
    QApplication a( argc, argv );

    QPushButton hello( "Hello world!", 0 );
    hello.resize( 100, 30 );

    a.setMainWidget( &hello );
    hello.show();
    return a.exec();
}

albeit C++, but then again GTK isn't exactly part of standard C reference either. Good to consider whether to use Qt or GTK+

Great point, April! :thumbup:

User avatar
wiak
Posts: 4036
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 62 times
Been thanked: 1176 times
Contact:

Re: Learning C: getting Devx and what do I do next?

Post by wiak »

Jafadmin wrote: Fri Aug 27, 2021 3:14 pm
wiak wrote: Fri Aug 27, 2021 3:00 pm

...
albeit C++, but then again GTK isn't exactly part of standard C reference either. Good to consider whether to use Qt or GTK+

Great point, April! :thumbup:

You seem to be a bit 'mixed up' as to whom you are replying, but not to worry...

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

Post Reply

Return to “Users”