473,387 Members | 1,760 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Correct C++ tutorial part 5 "How to use libraries" available (Windows, mingw/msvc/std)

The fifth part of my attempted Correct C++ tutorial is now available,
although for now only in Word format (use free Open Office if no Word), and
also, it's not yet been reviewed at all -- comments welcome!

"How to use libraries"
<url: http://home.no.net/dubjai/win32cpptut/w32cpptut_01_05.doc>

General URL:

<url: http://home.no.net/dubjai/win32cpptut/html/>

which provides parts 1 and 2 as web-pages (HTML) in addition to the
original Word documents of parts 1 through 5.

This fifth part is very concrete, very tool-oriented, and is therefore
possibly more difficult (it was far more difficult and time-consuming
to write than the earlier parts), and I think therefore also has a higher
chance of containing errors, sub-optimal ways of doing things, etc.

Contents, part 5:
1 [Background:] Classes, members & optional arguments.
2 Use library-specified types.
3 Find a library (or: find a set of libraries...).
4 Use a make-tool to build a library (long).
5 Use a Unix-like build environment for the GNU tools (long).
6 Do the same things for a second library (it's easier now!).
7 Create a library manually (the third time's the charm!).
8 Fix invalid C++ source code (the "old iostream" problem).
9 Use a library: create a picture programmatically.
10 Use header file wrappers (introducing the C++ preprocessor).
11 Use compiler response files.

As before, the point of inviting comments is to _fix_ anything incorrect, or
the presentation, or whatever; your input is valuable, and you can thereby
help those who stumble across this tutorial and use it to learn C++.

Thanks in advance,

- Alf

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 23 '05 #1
10 2014
Alf P. Steinbach wrote:
The fifth part of my attempted Correct C++ tutorial is now available,
although for now only in Word format (use free Open Office if no Word), and also, it's not yet been reviewed at all -- comments welcome!

"How to use libraries"
<url: http://home.no.net/dubjai/win32cpptut/w32cpptut_01_05.doc>

General URL:

<url: http://home.no.net/dubjai/win32cpptut/html/>

which provides parts 1 and 2 as web-pages (HTML) in addition to the
original Word documents of parts 1 through 5.

This fifth part is very concrete, very tool-oriented, and is therefore possibly more difficult (it was far more difficult and time-consuming
to write than the earlier parts), and I think therefore also has a higher chance of containing errors, sub-optimal ways of doing things, etc.


Howdy Alf, this is very good, but don't you think you should dive into
the bbasics of e.g. classes and other language semantics before going
into creating libraries etc...?
I would prefer if this was chapter 10 maybe instead of chapter 5...

Thomas

--
www.frostinnovation.com THE Pocket PC Service System Provider

Jul 23 '05 #2
* Thomas Hansen:

Howdy Alf, this is very good, but don't you think you should dive into
the bbasics of e.g. classes and other language semantics before going
into creating libraries etc...?
Well it's either that or use very platform-specific examples (e.g.
Windows API metafiles) or only very very dull examples or, write some
articially easy-to-use support libraries, perhaps with installer...

I did write a simple XBM image generator (an XBM image file is pure text,
actually C source code, which means std::cout is all the tool you need to
generate an XBM image file), but black/white is boring and Internet
Explorer 6.x doesn't seem to support the format, although reportedly
almost all other browsers do. I know earlier versions supported XBM for
internal web-page scripting. Perhaps IE 6 does still, haven't checked.

But the main reason I decided to go "out on the net" to fetch a library
was to _get real_, because it's the actual requirements of using real
code that drives the learning curve (in my experience, that is): which
features and tools and techniques need to be introduced and in what order.
Generating a PNG picture is trivial in C# + .NET, a beginner's task. It
shouldn't be that hard in C++, and it really isn't: it's just the tool
usage to (once) install the necessary libraries that is a bit complex.

I would prefer if this was chapter 10 maybe instead of chapter 5...


Heh. :-)

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 23 '05 #3
al***@start.no (Alf P. Steinbach) wrote in message news:<42**************@news.individual.net>...
* Thomas Hansen:

Howdy Alf, this is very good, but don't you think you should dive into
the bbasics of e.g. classes and other language semantics before going
into creating libraries etc...?


Well it's either that or use very platform-specific examples (e.g.
Windows API metafiles) or only very very dull examples or, write some
articially easy-to-use support libraries, perhaps with installer...

Might initial reaction was that I can't think of any sort of audience
that would have the patience to go through all the steps required to
download 2 or 3 separate libraries, configure/produce makefiles to
build them (even with a helping hand), and even modify the source to
get it to compile, but would not know what a member function was, or
even how to write a function (which you mention as the "next step" at
the end).

Having said that, I actually appreciate the fact that this tutorial
doesn't try to make everything look super simple - it all-too-honestly
recognises and addresses many of the typical complications that
programmers have to face when developing applications of any level of
sophistication. But Thomas is right, it's basically a chapter 10
tutorial, not a chapter 5 one.

Yes, it's unfortunate that there isn't a very very simple graphics
format that could both be generated by the most basic of C++ programs
and that most Windows users would be able to view without downloading
additional software, but if you really are keen to get users to
generate graphical images that soon, then I'd suggest having to
download an XBM or PNM viewer for Windows is a loss less work than
everything you're currently expecting of the poor novice programmer!
Jul 23 '05 #4
* Dylan Nicholson:
al***@start.no (Alf P. Steinbach) wrote in message news:<42**************@news.individual.net>...
* Thomas Hansen:

Howdy Alf, this is very good, but don't you think you should dive into
the bbasics of e.g. classes and other language semantics before going
into creating libraries etc...?
Well it's either that or use very platform-specific examples (e.g.
Windows API metafiles) or only very very dull examples or, write some
articially easy-to-use support libraries, perhaps with installer...

Might initial reaction was that I can't think of any sort of audience
that would have the patience to go through all the steps required to
download 2 or 3 separate libraries, configure/produce makefiles to
build them (even with a helping hand), and even modify the source to
get it to compile, but would not know what a member function was, or
even how to write a function (which you mention as the "next step" at
the end).


The description is incorrect: there's no "configure/produce makefiles".

The makefiles are made by those who created the libraries.

Also, why on Earth should a _patient_ person necessarily know about
C++ member functions?

Having said that, I actually appreciate the fact that this tutorial
doesn't try to make everything look super simple - it all-too-honestly
recognises and addresses many of the typical complications that
programmers have to face when developing applications of any level of
sophistication.
"all-too-honestly"?

But Thomas is right, it's basically a chapter 10
tutorial, not a chapter 5 one.


There are no prerequisites apart from a little patience and "can do" attitude.

People do not get more patient and "can do" as they learn more C++, they do
not develop new personality traits (except for a slight tendency to mutter
hexadecimal phrases), and knowing more C++ won't help in installing libraries.

Hence there's no good reason to wait.

Why should the reader be denied the tools to actually _do_ something?

What is accomplished by waiting, like no sex before marriage?

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 23 '05 #5
Alf P. Steinbach wrote:
The description is incorrect: there's no "configure/produce makefiles".

The makefiles are made by those who created the libraries.

Also, why on Earth should a _patient_ person necessarily know about
C++ member functions?

I am a newcomer to Windows programming and do not use any makefiles. In
fact I do not know what exactly they are. So I suppose makefiles is a
system dependent thing, and I think a C++ tutorial should not be
concerned with implementations but only with ISO C++.

And BTW keep it as simple as possible.

--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 23 '05 #6

Alf P. Steinbach wrote:
* Thomas Hansen:

Howdy Alf, this is very good, but don't you think you should dive into the bbasics of e.g. classes and other language semantics before going into creating libraries etc...?


Well it's either that or use very platform-specific examples (e.g.
Windows API metafiles) or only very very dull examples or, write some
articially easy-to-use support libraries, perhaps with installer...


Well, you could have progressed pretty far beyond branching by just
doing things like this first:
class Base
{
public:
virtual void foo()
{
std::cout << "Base::foo()";
}
};

class Derived : public Base
{
public:
virtual void foo()
{
std::cout << "Derived::foo()";
}
};

int main()
{
std::auto_ptr<Base> ptr( new Derived() );
ptr->foo();
return EXIT_SUCCESS;
}

....
Just my two cents...
But I like to learn the language semantics before I learn how to use
third part libraries/tools/etc...

All though that chapter is pretty importent I think it's wise to first
learn how to crawl, then to walk and then to think things like "why
walk when I can drive"...
;)
..t

Jul 23 '05 #7
* Ioannis Vranos:
Alf P. Steinbach wrote:
The description is incorrect: there's no "configure/produce makefiles".

The makefiles are made by those who created the libraries.

Also, why on Earth should a _patient_ person necessarily know about
C++ member functions?

I am a newcomer to Windows programming and do not use any makefiles. In
fact I do not know what exactly they are. So I suppose makefiles is a
system dependent thing,


Makefiles originated, as far as I know, with the Unix system, but are
now supported on all major platforms.

A typical makefile specifies how to build something, by listing
goals to be achieved (typically files to be produced), dependencies
between goals (the make tool checks the modification times of files
and infers from that and the dependencies which goals to pursue in
which order to do the minimum necessary for the top-level goal), and the
commands to be executed to achieve each goal.

Makefiles, or some other build automation such as Ant or your
favorite IDE's build command (which probably uses a generated makefile!)
are necessary to create things that consist of more than one C++ source
file, and/or to create things that are to be more-or-less _portable_,
to automate the (re)build process.

In medium or large projects makefiles can be preferred over IDE "projects"
because they can work with almost any tools, and are independent of IDE.

But in the same way as with C++ it's possible to write non-portable and
tool-specific makefiles.

and I think a C++ tutorial should not be
concerned with implementations but only with ISO C++.
Well, as I see it it's in the nature of a tutorial to be concerned with the
in-practice, but that doesn't mean to teach some dialect of C++: I think
you'll find that so far it's been only straight ISO C++.

And BTW keep it as simple as possible.


I'm trying -- but no simpler... ;-)

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 23 '05 #8
* Thomas Hansen:

.... you could have progressed pretty far beyond branching by just
doing things like this first:
class Base
{
public:
virtual void foo()
{
std::cout << "Base::foo()";
}
};

class Derived : public Base
{
public:
virtual void foo()
{
std::cout << "Derived::foo()";
}
};

int main()
{
std::auto_ptr<Base> ptr( new Derived() );
ptr->foo();
return EXIT_SUCCESS;
}

...
Just my two cents...
But I like to learn the language semantics before I learn how to use
third part libraries/tools/etc...

All though that chapter is pretty importent I think it's wise to first
learn how to crawl, then to walk and then to think things like "why
walk when I can drive"...
;)


I agree with the premises but I think they support and imply the exact
opposite conclusion... ;-)

Namely, learn how to use things that are designed to be easy to use before
learning to create them, which can be very difficult and can involve a really
staggering amount of detail unrelated to the immediate goals. For example,
learn how to drive a car before learning to design one. Would you rather
start with learning how to modify the engine to support faster driving?

There's an amount of trust involved, I think. The reader must trust that I
know of what I'm talking about and the way I'm pointing out and leading the
party onwards on. Explaining all the time that this will make sense later is
in my view an exercise in futility, since that's exemplified again and again;
but if the basic trust isn't there to begin with it might seem continually
surprising (e.g., the personell manager in a large consulting firm once asked
me right out whether I intentionally said and wrote things that only made
sense -- i.e. to some other persons -- some time later down the road, and
that's one price to pay for doing things right in the first place; to get a
_consensus_ that something is right, when one isn't in a position of being a
recognized authority, the issues must first be demonstrated and experienced
personally by the involved persons, and that can have a huge cost).

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 23 '05 #9
al***@start.no (Alf P. Steinbach) wrote in message news:<42****************@news.individual.net>...
* Thomas Hansen:

All though that chapter is pretty importent I think it's wise to first
learn how to crawl, then to walk and then to think things like "why
walk when I can drive"...
;)


I agree with the premises but I think they support and imply the exact
opposite conclusion... ;-)

Namely, learn how to use things that are designed to be easy to use before
learning to create them, which can be very difficult and can involve a really
staggering amount of detail unrelated to the immediate goals. For example,
learn how to drive a car before learning to design one. Would you rather
start with learning how to modify the engine to support faster driving?

Nifty analogy, but your current tutorial goes at great lengths to
explain which shops sell cars, where to find them, how to purchase
one, how to get it home, then all the various
adjustments/customizations you might need to make to it before you can
even start it. I wouldn't normally consider this part of "learning to
drive".

So ideally the user shouldn't need to worry about how the library gets
on to their machine, and getting it ready for use should be a
no-brainer. Unfortunately this isn't really possible unless you
severely limit the number of possible platforms - but it seems you
have already done this anyway. Is it not possible/legal for you to
just provide the libraries already built and ready-to-go for download,
along with the most basic instructions necessary to link them into the
application?

Anyway, at the end of the day, you need to test-drive the tutorial on
some newbies. If you find that they are happy to follow all the
instructions you give just to create their first
programmatically-generated image, then all's well and good, and you
can ignore our carping cynicism!
Jul 23 '05 #10
* Dylan Nicholson:

Is it not possible/legal for you to
just provide the libraries already built and ready-to-go for download,
along with the most basic instructions necessary to link them into the
application?


It is possible, and also legal, but that is of no use to someone who needs
some other library. It's also possible to make the creation of a word-
processor a one-click option. For example. ;-)

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 23 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Pete Mahoney | last post by:
Ok I use a textarea to store data input by the user, and then upon them clicking the submit button I store this data to a database. The problem is once the user inputs too much data (about 3...
5
by: John Oliver | last post by:
I'd like the email produced by FormMail to show a specific From: address rather than postmaster@server.host.name Googling isn't helping me... not sure what to look for :-( -- * John Oliver ...
20
by: John Bailo | last post by:
http://www.joelonsoftware.com/articles/APIWar.html "So you've got the Windows API, you've got VB, and now you've got .NET, in several language flavors, and don't get too attached to any of...
44
by: Tolga | last post by:
As far as I know, Perl is known as "there are many ways to do something" and Python is known as "there is only one way". Could you please explain this? How is this possible and is it *really* a...
1
by: uli2003wien | last post by:
Dear group, i am a seasoned DB2-veteran (6 years exp.) on the Windows- and Linux-Server platform. Once in a while i had a look into DB2 on the mainframe but mostly only watching other people do...
6
by: Chris Stankevitz | last post by:
At link time, MSVC determines some of my libraries are unused and doesn't link them into my exe. This undesirable feature causes problems when I employ the factory pattern. With the factory...
0
by: eljainc | last post by:
Hello, I'm looking for an imaging library that is compatible with Visual Studio 2005 that has imaging/display capabilities to that of ITunes. What I mean is the part of the ITunes program that...
2
by: anon.asdf | last post by:
Hello! 1) =============================== When trying to define an array of std::string ... func( (std::string ) { std::string("ab"), std::string("cd"), std::string("ef") } , 3 ); ...
26
by: Jake Barnes | last post by:
I did a search on the newsgroup comp.lang.javascript. I was searching for "how to play a sound with Javascript". I'm somewhat suprised that the majority of entries are from the 1990s, and there are...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.