Learning C / C++
I would like to learn to program my Pi with C / C++.
Is there a list of the included Libraries and what they do / contain?
A pdf would be very nice. How can I program if i don't know what commands are available?
Thanks
Is there a list of the included Libraries and what they do / contain?
A pdf would be very nice. How can I program if i don't know what commands are available?
Thanks
Re: Learning C / C++
Google will find you several C tutorials. http://www.cprogramming.com/tutorial/c-tutorial.html comes near the top of the results. If that doesn't suit you, try one of the others,
As for libraries, there are lots !
Rather than trying to find out about all of them, I suggests you choose a project and then look (google) for appropriate ones to your project.
PeterO
As for libraries, there are lots !

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson
Re: Learning C / C++
I would recommend a book - Exercises for Programmers by Brian P. Hogan. It is language neutral as it simply sets 57 'tasks' from 'say Hello' to writing 5 full programs (ToDo list etc). After that I would pick a smallish program you will use - a 'pillow project', and code that. Coding something that you want is a great driver to fight language subtleties, learn defensive code techniques etc, etc. Unfortunately the book is only available in a dead tree edition AFAIK.
Hope this helps.
Paul
Hope this helps.
Paul
Pwl2
Re: Learning C / C++
There has never been a time in the history of the universe where more information about programming has been available to all as easily as it is today. Rejoice! Just google C standard library and you'll get a ton to read: https://en.wikipedia.org/wiki/C_standard_librarytech-mech wrote:A pdf would be very nice. How can I program if i don't know what commands are available?
Re: Learning C / C++
As C and to a certain extent C++ serve as the systems programming languages for Linux, almost every available library and function is available. Having too many libraries can be overwhelming: there are multiple libraries for sorting, linear algebra, FFTs and other algorithms as well as incompatible libraries for building mouse interfaces and three dimensional graphics applications. In comparison Java, Visual C# and Free Pascal make things easier by providing similar functionality through more limited choices available in standard libraries.tech-mech wrote:I would like to learn to program my Pi with C / C++.
Is there a list of the included Libraries and what they do / contain?
A pdf would be very nice. How can I program if i don't know what commands are available?
Thanks
The updated editions of the original book by Kernighan and Ritchie "The C Programming Language" is still very good because of its clarity and not being overstuffed with irrelevant examples of poor programming style. This book focuses on writing command line programs, which avoids lots of unnecessary complexity. While many useful tasks are better done without a custom designed mouse interface, things like writing a video game would require reading other resources as well. Even if creating mouse interfaces and graphics is your ultimate goal, I would recommend starting simple by writing a number of command line programs first.
Re: Learning C / C++
K&R +1ejolson wrote:The updated editions of the original book by Kernighan and Ritchie "The C Programming Language" is still very good because of its clarity and not being overstuffed with irrelevant examples of poor programming style.
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson
Re: Learning C / C++
Good for you, the Pi is a great platform for learning.tech-mech wrote:I would like to learn to program my Pi with C / C++.
Is there a list of the included Libraries and what they do / contain?
A pdf would be very nice. How can I program if i don't know what commands are available?
Thanks
Because there is a vast number of library functions and programming tools available, your are best deciding what you want to do first.
On the system itself is a set of manual pages.
Code: Select all
man strcpy
You will likely not know what the function is called. Either try google, or try "apropos" or "man -k" which searches the short descriptions and manual page names for the string you give.
Code: Select all
man -k string
You need this if the name is in more than one section. Unsurprisingly see "man man" for details.
Re: Learning C / C++
I would first ask yourself why you would need plain C. If there is no good answer, please do yourself a favor and skip it and go straight to C++. Bjarne Stroustroup himself does not recommend learning C first. The only exception is if you really need C. And I think the only reason for needing C is if you're working on an old codebase that is in C. Of course there's a lot of that, from the Linux kernel to the Apache webserver to the Postgres database, etc etc. If you're looking to get involved in something like that then great! But in my opinion there's little reason to start a new project without taking advantage of C++11/14 features.
As for libraries, of course there's the C++ standard library which can do all kinds of abstract things. All kinds of other libraries are included in the Raspian repository, for things like databases, GUI, math/science, whatever. It's an endless world of opportunity!
As for libraries, of course there's the C++ standard library which can do all kinds of abstract things. All kinds of other libraries are included in the Raspian repository, for things like databases, GUI, math/science, whatever. It's an endless world of opportunity!
Re: Learning C / C++
Bucky at thenewboston has lots of tutorials. for programming.
He's pretty funny, when he teaches.
https://thenewboston.com/videos.php?cat=16
He's pretty funny, when he teaches.
https://thenewboston.com/videos.php?cat=16
Re: Learning C / C++
I suspect the Linux kernel is written in C rather than C++ because Linus felt C is better for writing an operating system kernel. Interestingly, many years later he designed and developed a source management system called git in C as well.yodermk wrote:I would first ask yourself why you would need plain C. If there is no good answer, please do yourself a favor and skip it and go straight to C++. Bjarne Stroustroup himself does not recommend learning C first. The only exception is if you really need C. And I think the only reason for needing C is if you're working on an old codebase that is in C. Of course there's a lot of that, from the Linux kernel to the Apache webserver to the Postgres database, etc etc. If you're looking to get involved in something like that then great! But in my opinion there's little reason to start a new project without taking advantage of C++11/14 features.
Quoting from Robert Pike who has been involved with Unix from the beginning at Bell Labs and currently works at Google with Brian Kernighan.
The new programming language he refers to is called golang or just go. While it is nice in many ways, it is not as central as C or even C++ on Linux. At the present time, I suspect the only reason someone would learn golang before C is by having an over enthusiastic computer science teacher.Rob Pike wrote:A couple of years ago, several of us at Google became a little frustrated with the software development process, and particularly using C++ to write large server software. We found that the binaries tended to be much too big. They took too long to compile. And the language itself, which is pretty much the main system software language in the world right now, is a very old language. A lot of the ideas and changes in hardware that have come about in the last couple of decades haven’t had a chance to influence C++. So we sat down with a clean sheet of paper and tried to design a language that would solve the problems that we have: we need to build software quickly, have it run well on modern multi-core hardware and in a network environment, and be a pleasure to use.
The C programming language is simple enough that the entire language can be mastered by many in less than a year. It appears to me that C++ is so complicated that most people who use it haven't mastered the entire language. From what I remember, the main intention of C++ was to allow code from non-cooperating programmers to be used in the same project. While open source has increased the level of cooperation remarkably, for very large software projects the additional features of C++ can help.
Good luck with your learning project. Feel free to check back with questions and progress.
Re: Learning C / C++
giving hints about "learning C" is like giving hints about "learning a foreign language most different from anything what you knew or read or heard about before, perhaps Hopi or isiXhosa" . Or perhaps German, for probably 99% of the world's citizens
.
I was learning basics (0.5% of my skills) about C/C++ by tutorials and books about Borland Turbo C and C++ Builder, and much of the rest I know by programming Arduinos, using the very illustrative Arduino Playground tutorials (relatively 99.5% of my skills, about 0.1% of overall-C ressources).
edit, I stand corrected: just 99.4%, 0.1% was by struggling with C for Raspi.
My hint:
start learning C on a far simpler platform. i.e., e.g., Arduinos, because there are lot of excellent links and examples and tutorials.
For Rasperry Pi, I am dispairing too, FTM, for lack of excellent links and examples and tutorials .... and even ressources, because most of driver libs are not available for C, but just for that crappy Python....
ps.
if you (or your browser) is capable of German,....
I wrote a Quick Guide for programming the Pi in C, for bloody dummies....:
Quick Guide für Raspberry Pi: C/C++ mit Geany für Dummies
http://www.mindstormsforum.de/viewtopic ... 689#p67768
but it's more about the setup of the ressources, and only little about actually programming...
... and the rest is: Learning by doing!
BTW: Here's an excellent C/C++ language reference ressource:
http://www.cplusplus.com/doc/tutorial/
http://www.cplusplus.com/reference/clibrary/
HTH!

I was learning basics (0.5% of my skills) about C/C++ by tutorials and books about Borland Turbo C and C++ Builder, and much of the rest I know by programming Arduinos, using the very illustrative Arduino Playground tutorials (relatively 99.5% of my skills, about 0.1% of overall-C ressources).
edit, I stand corrected: just 99.4%, 0.1% was by struggling with C for Raspi.

My hint:
start learning C on a far simpler platform. i.e., e.g., Arduinos, because there are lot of excellent links and examples and tutorials.
For Rasperry Pi, I am dispairing too, FTM, for lack of excellent links and examples and tutorials .... and even ressources, because most of driver libs are not available for C, but just for that crappy Python....
ps.
if you (or your browser) is capable of German,....
I wrote a Quick Guide for programming the Pi in C, for bloody dummies....:
Quick Guide für Raspberry Pi: C/C++ mit Geany für Dummies
http://www.mindstormsforum.de/viewtopic ... 689#p67768
but it's more about the setup of the ressources, and only little about actually programming...
... and the rest is: Learning by doing!
BTW: Here's an excellent C/C++ language reference ressource:
http://www.cplusplus.com/doc/tutorial/
http://www.cplusplus.com/reference/clibrary/
HTH!
Last edited by davenull on Mon Feb 29, 2016 10:28 pm, edited 2 times in total.
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}
Re: Learning C / C++
The drawback with learning on an Arduino is that is not a standard platform with lots of libraries and facilities missing. No filesystem or networking or display to learn about. And no way to learn about using all the tools that support C/C++ programming like make.davenull wrote: My hint:
start learning C on a far simpler platform. i.e., e.g., Arduinos,
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson
Re: Learning C / C++
but you will learn the basic C syntax on Arduino, which is indispensible and which will be crucial frustrating for a newbie if you'd have to fight and struggle with all that crappy Linux stuff on Raspi before you might even get your first "Hello World" starting....
Arduino is:
load the IDE,
start programming,
upload,
and it works, out of the box!
which is finally the reason for the world-wide tremendous success of the Arduino concept!
Arduino is:
load the IDE,
start programming,
upload,
and it works, out of the box!
which is finally the reason for the world-wide tremendous success of the Arduino concept!
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}
Re: Learning C / C++
Regarding C++ being too complex to master in a reasonable time, perhaps; but remember that it's designed so that you don't have to use every feature, and you don't pay for (in terms of performance and memory) what you don't use.
If nothing else, you should use C++ style I/O and things like auto variables and smart pointers because it's just a better way of doing things than you have in C. You don't have to use OOP, or write your own templates, or whatever.
Some people (like Linux) keep using C because they know it like the back of their hand. That doesn't mean it's the best thing to start with. A kernel, if you started writing it today, could absolutely be done in C++. It's designed for that kind of thing. Again, don't overcomplicate it. You don't have to use all the features of the language. Use what you understand and what makes sense in the specific engineering concerns of your project. Often that might not be much more than C, but just by using the C++ compiler you can still get some big benefits.
If nothing else, you should use C++ style I/O and things like auto variables and smart pointers because it's just a better way of doing things than you have in C. You don't have to use OOP, or write your own templates, or whatever.
Some people (like Linux) keep using C because they know it like the back of their hand. That doesn't mean it's the best thing to start with. A kernel, if you started writing it today, could absolutely be done in C++. It's designed for that kind of thing. Again, don't overcomplicate it. You don't have to use all the features of the language. Use what you understand and what makes sense in the specific engineering concerns of your project. Often that might not be much more than C, but just by using the C++ compiler you can still get some big benefits.
- ShiftPlusOne
- Raspberry Pi Engineer & Forum Moderator
- Posts: 6382
- Joined: Fri Jul 29, 2011 5:36 pm
Re: Learning C / C++
While I was at uni (not that long ago), I was working on relatively simple firmware for a device. I kept running out of space and memory. The firmware was very simple... read a few inputs, print a few things on the screen, send some things over the network. I then rewrote it in C, pretty much as it was (change cout to printf and so on). Suddenly, the memory footprint and program size dropped significantly.yodermk wrote:Regarding C++ being too complex to master in a reasonable time, perhaps; but remember that it's designed so that you don't have to use every feature, and you don't pay for (in terms of performance and memory) what you don't use.
If nothing else, you should use C++ style I/O and things like auto variables and smart pointers because it's just a better way of doing things than you have in C. You don't have to use OOP, or write your own templates, or whatever.
Some people (like Linux) keep using C because they know it like the back of their hand. That doesn't mean it's the best thing to start with. A kernel, if you started writing it today, could absolutely be done in C++. It's designed for that kind of thing. Again, don't overcomplicate it. You don't have to use all the features of the language. Use what you understand and what makes sense in the specific engineering concerns of your project. Often that might not be much more than C, but just by using the C++ compiler you can still get some big benefits.
A counter-example is that I was working on a simple GUI toolkit and found myself implementing C++ features in C, then shelved the project to redo it in C++ later. So now I default to C and only consider switching to C++ when the task is inherently OO-friendly.
What am I missing? Why did I have problems with it in the past if I should be seeing better performance simply by using a C++ compiler?
Re: Learning C / C++
what did I miss, who was opposing to use a C++ compiler?
I am also using gpp and using C++ libs, but myself I'm just writing ANSI C syntax, both on Raspberry and Arduino (which is also always C++ based).
But my point actually is a different one:
for a complete beginner a Raspi is too hard and too frustrating to start with in order to learn C/C++, because of all the underlying Linux stuff.
OTOH, on Arduino you might learn the basics of C/C++ a thousand times more easy, as you can focus on your program and don't have to struggle with OS issues.
I am also using gpp and using C++ libs, but myself I'm just writing ANSI C syntax, both on Raspberry and Arduino (which is also always C++ based).
But my point actually is a different one:
for a complete beginner a Raspi is too hard and too frustrating to start with in order to learn C/C++, because of all the underlying Linux stuff.
OTOH, on Arduino you might learn the basics of C/C++ a thousand times more easy, as you can focus on your program and don't have to struggle with OS issues.
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}
- gordon@drogon.net
- Posts: 2023
- Joined: Tue Feb 07, 2012 2:14 pm
- Location: Devon, UK
Re: Learning C / C++
BASIC, anyone?davenull wrote:what did I miss, who was opposing to use a C++ compiler?
I am also using gpp and using C++ libs, but myself I'm just writing ANSI C syntax, both on Raspberry and Arduino (which is also always C++ based).
But my point actually is a different one:
for a complete beginner a Raspi is too hard and too frustrating to start with in order to learn C/C++, because of all the underlying Linux stuff.
OTOH, on Arduino you might learn the basics of C/C++ a thousand times more easy, as you can focus on your program and don't have to struggle with OS issues.

-Gordon
--
Gordons projects: https://projects.drogon.net/
Gordons projects: https://projects.drogon.net/
Re: Learning C / C++
perhaps, if you love spaghetti... 

#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}
- gordon@drogon.net
- Posts: 2023
- Joined: Tue Feb 07, 2012 2:14 pm
- Location: Devon, UK
Re: Learning C / C++
You are mistaking BASIC with bad programming practices.davenull wrote:perhaps, if you love spaghetti...
Show me the Italian pasta here:
Code: Select all
// factorial:
// Recursive factorial generator
// Demonstration of number formatting and recursion
numformat (15, 0)
for i = 1 TO 16 cycle
print i; "! = "; fn factorial(i)
repeat
end
def fn factorial (n)
if n = 1 then
= 1
else
= n * fn factorial(n - 1)
endif
--
Gordons projects: https://projects.drogon.net/
Gordons projects: https://projects.drogon.net/
Re: Learning C / C++
I don't see that.davenull wrote:for a complete beginner a Raspi is too hard and too frustrating to start with in order to learn C/C++, because of all the underlying Linux stuff.
OTOH, on Arduino you might learn the basics of C/C++ a thousand times more easy, as you can focus on your program and don't have to struggle with OS issues.
If your program is command-line only, then RaspPi is much more friendly than the Arduino where you need a non-C-standard library for every bit of interaction.
Code: Select all
#include <stdio.h>
main()
{
printf("hello world!\n");
}
Re: Learning C / C++
well, as already stated above:
ask two programmers and you'll get three answers.
(and command lines are killing me...
)
or:giving hints about "learning C" is like giving hints about "learning a foreign language most different from anything what you knew or read or heard about before, perhaps Hopi or isiXhosa" .
ask two programmers and you'll get three answers.
(and command lines are killing me...

#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}
Re: Learning C / C++
I do wish people wouldn't post that poor version of hello.c It doesn't compile cleanly !
It should be ,,,,
which compiles cleanly !
Or my prefered version :
And don't get me started on code that doesn't parse the command line !
PeterO
Code: Select all
gcc -Wall hello.c
hello.c:3:1: warning: return type defaults to ‘int’ [-Wreturn-type]
main()
^
hello.c: In function ‘main’:
hello.c:6:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
Code: Select all
#include <stdio.h>
int main(void)
{
printf("Hello World!\n");
return 0;
}
Or my prefered version :
Code: Select all
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
printf("Hello World!\n");
exit(EXIT_SUCCESS);
}

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson
Re: Learning C / C++
as I stated:
never start learning C(++) on a Raspi....
nothing left to say...
never start learning C(++) on a Raspi....
nothing left to say...

#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}
- gordon@drogon.net
- Posts: 2023
- Joined: Tue Feb 07, 2012 2:14 pm
- Location: Devon, UK
Re: Learning C / C++
Arduino provides you with a nice cozy little closed-room type environment. I do not believe most people actually learn much programming skills using it as-such. You learn how to join the dots on a myriad of pre-build librarys, classes and so on. But what if you want to write your own library/class?davenull wrote:as I stated:
never start learning C(++) on a Raspi....
nothing left to say...
Then you need to learn to program.
This is where you're at right now.
Personally, I'd suggest that the command-line under Linux is an easy place to start, however there is all this getting to grips with the command-line in the first place, but once you're there, you have the wealthiest of programming environments at your fingertips.
-Gordon
--
Gordons projects: https://projects.drogon.net/
Gordons projects: https://projects.drogon.net/
Re: Learning C / C++
command line under Linux, yes:
g++ -Wall -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -o myfile.c myfile -pthread -lshapes -L/opt/vc/lib -lOpenVG -lEGL -lrt -lwiringPi -lpigpio
my goal actually is to focus on programs, not to struggle with the OS.
So I could focus on establishing the world-wide first autonomous recurrent neural multilayer net on Arduino (a Jordan net), after 1 month Arduino programming practice
(I admit that I already established the world-wide first autonomous neural single layer net on Lego NXT before, written in NXC, so I had a little experience in the world of "Not-eXactly"
)
On Raspi instead, it's why I am where I am.
Thank Heaven, and thanks to you Gordon, there is eventually wiringPi to fake wiring Arduino
without quite knowing about that, I had almost already abandoned all that Raspi C - and the whole Raspi thing - 5 months ago...
g++ -Wall -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -o myfile.c myfile -pthread -lshapes -L/opt/vc/lib -lOpenVG -lEGL -lrt -lwiringPi -lpigpio
my goal actually is to focus on programs, not to struggle with the OS.
So I could focus on establishing the world-wide first autonomous recurrent neural multilayer net on Arduino (a Jordan net), after 1 month Arduino programming practice

(I admit that I already established the world-wide first autonomous neural single layer net on Lego NXT before, written in NXC, so I had a little experience in the world of "Not-eXactly"

On Raspi instead, it's why I am where I am.
Thank Heaven, and thanks to you Gordon, there is eventually wiringPi to fake wiring Arduino

without quite knowing about that, I had almost already abandoned all that Raspi C - and the whole Raspi thing - 5 months ago...

Last edited by davenull on Fri Mar 04, 2016 2:10 pm, edited 1 time in total.
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}