LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   code blocks header files (https://www.linuxquestions.org/questions/linux-newbie-8/code-blocks-header-files-4175490120/)

clayton1 01-04-2014 08:01 AM

code blocks header files
 
Hello
I'm using code blocks 12.11

As a newbe to programming I have a couple of Questions.

Is C++ a good choice to learn to program for linux apps?
(this is where i'm spending most of my time)

Or is python a better choice to learn to program for linux apps?

They both appear to me to have alot of similarities.

In either one .... how do you know which standard header file to include in your
program which defines the keywords you use? eg. getchar() or setw() or clrscr().
When I copy code off the net, I have alot of problems because the header files are not right.
For a inexperienced newbe going through each one trying to figure it out
can get fustrating really fast. Is there a chart somewhere that matches

the keywords and commands to a standard header file for reference?

all replies will be greatly appreciated. Thank You!

neonsignal 01-23-2014 07:57 PM

Quote:

Originally Posted by clayton1 (Post 5091788)
Is C++ a good choice to learn to program for linux apps?
Or is python a better choice to learn to program for linux apps?

This depends on your application.

Python is easier to learn, and makes a great introductory language. It has a good sized community (which translates to lots of reusable code and libraries), and is nicely general purpose.

C++ has found its place in the development of large applications, and has been designed to enable a number of different programming paradigms. Because of the way it evolved from C, some of the syntax can sometimes be confusing. It is a very stable language. To learn it well takes quite a while, but of course you don't need to know the whole language in order to use it.

I should mention that many Linux applications are developed in C rather than C++; however, as a learner, it is good to be exposed to the object oriented paradigm early, even if you don't end up using it. There are a small set of applications where efficiency or direct hardware access is important. C and C++ are good in these cases, being 'closer to the metal'.

The other important alternative to be aware of is the functional programming paradigm, in languages such as Haskell. These are less commonly used, but they could have a bright future in world that is moving towards increased parallelism (ie, massive numbers of CPU/GPU cores).

Learning a second computer language is usually easier than the first one, so the first choice is not as important as who you learn from.

Quote:

how do you know which standard header file to include in your
program which defines the keywords you use? eg. getchar() or setw() or clrscr().
One can of course simply grep for them in the header files, but it is best to find a good source of reference documentation. For C++, this site is useful, since you can look up any function to figure out its header file, and there is usually a complete and compilable example of the usage. Likewise for python documentation. If you intend to do a serious amount of programming, there are reference books (eg Stroustrup's "The C++ Programming Language") that give good overviews of the language.

jpollard 01-23-2014 10:00 PM

And things like getchar() or setw() or clrscr() are not keywords. They are functions (or macros).

Keywords would be things like "if", "while" "include" "extern"... usually referred to as "reserved words" or "reserved tokens".


All times are GMT -5. The time now is 09:08 PM.