C going to C++

S

Steven T. Hatton

Leor said:
Well, all I had to go on (since I've never even heard of "Qt" before this
thread) was what Steven T. Hatton wrote, that "it is all standard C++".
I was merely repeating what I was told by people at TrollTech. That's why I
backed off. I don't understand it well enough to substantiate the claim.
But basically, Signals and Slots are implemented with high powered macros
of some kind.

http://doc.trolltech.com/3.3/moc.html
As
we've learned around here, Steven is never wrong.
-leor

I've never claimed I'm never wrong. And sometimes when I'm right, I don't
even know it. E.g., taking out the name hiding stuff in that virtual
inheritance example. That was just plain dumb luck. I took out the part I
didn't understand, and started pulling the example apart.

BTW, you were intimating I might to better to chose another book. A few
things I should point out. I put the book down for several months, so I'm
really rusty on the first part. I haven't been working the exercises.
(like I did with the Feynman Lectures on Physics - no I never finished the
entire 3 Volumes, but I do still have the (original) problem sets. :-D ) I
suspect Stroustrup put some of the important lessons in the problems. It
seems to me, his goal is to teach you how to think about solving the kind
of problem in question at the fundamental level, not by a set of memorized
rules. That's what you took for me knowing more than I let on. It all just
fell into place.

There was another thread going on at the same time discussing how to do
things in the opposite direction. That is, call the functions in the
baseclass not the derived class. I need to revisit that topic.
 
J

Jon Bell

[about wxWidgets, formerly wxWindows]
P.S.: I believe that the library has great potencial and that the new
name is better than the previous one. But that's jus me.

For an example of widely-used cross-platform software that uses this
library, see VueScan, scanning software that can drive a variety of film
and flatbed scanners: <http://www.hamrick.com/vsm.html>.
 
K

Kevin Torr

Claudio Puviani said:
Kevin Torr said:
I've been using C for some time now and I would
like to take my first leap into C++. I should warn
you that I have little or no experience with visual
C++, though I do have some experience with different
OOP languages.

I am using Microsoft Visual C++ 6.0.

I would like to create a very simple program to
begin with:

A dialog box, say 320x240 in size, with file->exit and
help->about menus.
[rest snipped]

As boring as it may seem, you'll learn far more by avoiding GUIs, databases,
and other platform-specific distractions and by modeling various problems
using the core C++ language and libraries. Once you're comfortable with
that, it will be a lot easier to expand into other territories.

Makes sense. I've done a fair bit of C command-line stuff, and the reason I
wanted to move into C++ was because of it's GUI capabilities. Is there
really that much difference between C and C++ that I need to start from the
command line all over again? :(

I've been building things like graphics converters, file encrypters, file
splicers etc - all of these would be a lot more user-friendly with a
graphical interface rather than typing massive strings into DOS.
 
L

Leor Zolman

Claudio Puviani said:
Kevin Torr said:
I've been using C for some time now and I would
like to take my first leap into C++. I should warn
you that I have little or no experience with visual
C++, though I do have some experience with different
OOP languages.

I am using Microsoft Visual C++ 6.0.

I would like to create a very simple program to
begin with:

A dialog box, say 320x240 in size, with file->exit and
help->about menus.
[rest snipped]

As boring as it may seem, you'll learn far more by avoiding GUIs, databases,
and other platform-specific distractions and by modeling various problems
using the core C++ language and libraries. Once you're comfortable with
that, it will be a lot easier to expand into other territories.

Makes sense. I've done a fair bit of C command-line stuff, and the reason I
wanted to move into C++ was because of it's GUI capabilities.

C++ does not /have/ "GUI capabilities". C++ is a programming language, not
a GUI framework. "Microsoft Visual C++" is a product that combines the C++
language and Standard (NON-graphical) library with a bunch of proprietary
GUI libraries and tools.

There are other language that support GUI frameworks (C, Java [which
actually /does/ bundle the GUI framework into the standard development
system], Visual Basic, lots of other.

There are GUI frameworks other than Microsoft's MFC or .NET that work with
C++: wxWidgets for example (my favorite).

Some people believe Microsoft invented C++, so that all the GUI facilities
provided with Visual C++ are somehow part of the "The C++ Language". No.
Is there
really that much difference between C and C++ that I need to start from the
command line all over again? :(

Independent of the preceding GUI issue, the answer is still yes. Well, you
don't /have/ to start from the command line, but by decoupling the GUI
facilities from the language facilities while you learn, you'll at least
have a prayer of retaining your sanity. They're /each/ complex so that
you're better off not having to learn the other at the same time. Since the
GUI facilities use the language facilities, is makes sense to begin with
the language facilities /in isolation from/ the GUI facilities. That leaves
you with: the command-line.
I've been building things like graphics converters, file encrypters, file
splicers etc - all of these would be a lot more user-friendly with a
graphical interface rather than typing massive strings into DOS.

Sounds good. As Scott Meyers has said (though not with regard to this exact
same subject): "There's no reason to get ahead of ourselves. First we
crawl. Later we crawl on broken glass."
-leor
 
C

Claudio Puviani

Kevin Torr said:
Claudio Puviani said:
Kevin Torr said:
I've been using C for some time now and I would
like to take my first leap into C++. I should warn
you that I have little or no experience with visual
C++, though I do have some experience with different
OOP languages.

I am using Microsoft Visual C++ 6.0.

I would like to create a very simple program to
begin with:

A dialog box, say 320x240 in size, with file->exit and
help->about menus.
[rest snipped]

As boring as it may seem, you'll learn far more by avoiding
GUIs, databases, and other platform-specific distractions
and by modeling various problems using the core C++
language and libraries. Once you're comfortable with that,
it will be a lot easier to expand into other territories.

Makes sense. I've done a fair bit of C command-line stuff, and
the reason I wanted to move into C++ was because of it's GUI
capabilities.

C++ doesn't have better GUI capabilities than C. It's just that there are
frameworks that make GUI programming easier.
Is there really that much difference between C and C++ that
I need to start from the command line all over again? :(

Lord, yes! It's not just a question of learning the language features,
though there are certainly many new ones, but of learning the proper
idiomatic use of the language. Don't let this discourage you. It's easy if
you take it in gradually and allow yourself the time to learn it the right
way.
I've been building things like graphics converters, file encrypters,
file splicers etc - all of these would be a lot more user-friendly
with a graphical interface rather than typing massive strings into
DOS.

They would, and you'll eventually do it. I just think it's not the right
place to start learning C++. Most, if not all, GUI frameworks force bad
programming practices for reasons of expediency and to lower the learning
curve for new users. I've noticed that people who start C++ programming from
there are very hard to wean away from those practices. You'll often see that
even in this forum with people justifying abominable design decisions with
"but MFC does it that way." :)

But everyone is different. If you feel that you're capable of learning
questionable practices and then freely abandon them as you learn better ways
(and many people can't), maybe having the visual rewards that GUI
programming offers will motivate you to go forward faster.

Claudio Puviani
 
J

John Tsiombikas (Nuclear / the Lab)

Leor said:
Well, all I had to go on (since I've never even heard of "Qt" before this
thread) was what Steven T. Hatton wrote, that "it is all standard C++". As
we've learned around here, Steven is never wrong.
-leor

Try not to trust blindly something someone said, since we all make
mistakes or missunderstand questions.
Qt may be written in standard C++, however you cannot compile a program
that uses Qt with a C++ compiler directly. It has it's own preprocessor
that you must use before that. Now image what would happen if every
library out there required a custom preprocessing stage...

One a personal note, I prefer GTKmm when I need GUI stuff. It is as easy
to use as Qt (which admittedly appart from the signals&slots thing has a
pretty well-structured interface), but you can also use it through
standard C++
 
J

jeffc

Kevin Torr said:
I understand what you're saying.

Where can I find a tutorial that will show me the steps in writing a C++
program that will perform my task, or at least something visually similar?

A box with an input, an output field, and a button that runs the function.

I think you're still missing the point. Anything "visual" like that isn't
part of C++ per se. You're going to have to get a book on your specific
application (Visual C++). One book that does a good job separating the
Windows part from the C++ part is "Beginning Visual C++" by Horton.
 
J

jeffc

Kevin Torr said:
Makes sense. I've done a fair bit of C command-line stuff, and the reason I
wanted to move into C++ was because of it's GUI capabilities. Is there
really that much difference between C and C++ that I need to start from the
command line all over again? :(

C++ doesn't have any GUI capabilities! Only products like Visual C++ etc.
have GUI capabilities. A straight C++ compiler will not give you that.
Visual C++ is a C++ compiler plus a whole bunch of Windows stuff built
together into a development environment. You can use the development
environment to organize your code and still write what are called "console
applications" in Visual C++. That's the only way you'll be able to use
"pure" C++. Otherwise, you've got 2 whole subjects to learn.
 
S

Steven T. Hatton

John said:
Try not to trust blindly something someone said, since we all make
mistakes or missunderstand questions.
Qt may be written in standard C++, however you cannot compile a program
that uses Qt with a C++ compiler directly.

That's actually only partially true. You /can/ do everything moc does by
hand, and thus create a fully C++ Standard compliant program which could
also be compiled through the full Qt process using moc. The code written
to be processed by moc is (AFAIK) Standard C++. The part people seem to
believe is non-standard consists of macro invocations.
It has it's own preprocessor
that you must use before that.

That really isn't true. You /can/ do it by hand. Moc is simply a
convenience. So convenient in fact that not using it would be silly.
Now image what would happen if every
library out there required a custom preprocessing stage...

This argument is a bit spurious in view of the fact that most of the reason
for creating moc was to compensate for the lack of features in the C++
Standard of the time as well as the lack of support in the C++ compilers
for features that could otherwise have been used to achieve the same ends.
One a personal note, I prefer GTKmm when I need GUI stuff. It is as easy
to use as Qt (which admittedly appart from the signals&slots thing has a
pretty well-structured interface), but you can also use it through
standard C++

Qt has been fairly successfull. It doesn't look as though the Troll are
overly interested in tossing moc, though they seem to acknowledge the
technical feasibility of doing so. Mozilla uses a different approach which
is similar to moc in that it requires an IDL-based preprocessor available
(IIRC) through GTK.

I'm not wholly unsympathetic to your desire to avoid the proliferation of
additional preprocessors and other such gadgetry, OTOH, one might attempt
the same argument against using gnu autotools. There are partial
alternatives, to include TrollTech's qmake (a very nice tool, I will add),
but the gnu autotools have a significant track record of success.

There's also another argument for my favoring Qt. It may seem unreasonable
in terms of software development, but I suspect, in the big picture, it
makes a lot of sense. Loyalty.
 
D

Davor

I've been using C for some time now and I would like to take my first leap
into C++. I should warn you that I have little or no experience with visual
C++, though I do have some experience with different OOP languages.

I am using Microsoft Visual C++ 6.0.

I would like to create a very simple program to begin with:

A dialog box, say 320x240 in size, with file->exit and help->about menus.
Inside the box will be an input field where you type in your number, and a
button that says 'Go'.
Under that will be another text field which will give you 2* what you typed
previously if it's a number, otherwise it pops up with an error box saying
"Please enter only integers and decimals into the box".

So this is what I have done so far:
Created a new "Win32 application" project called "thetest".
I then create a new "C++ Source File" called "thesource" and add it to the
workspace "thetest".
I go up to 'insert -> resource -> menu' and create the menu
I save the resource as 'menu.rc' and 'menu.rc' to the 'Resource Files'
folder in the 'File View'

This is about as far as I can get without a tutorial or instructions to get
me further.
I'm not sure how to access the resources I have included to the project from
the C++ source file.

If someone could followup with either instructions or a URL that can run me
through this step-by-step, it would be very handy. Thanks.

Also, How do I remove files/resources from my workspace? There is no
'delete' item in the right-click menu!

Thanks.

First of all. Do you know how to do this in C?
--
Kamratligen,
Davor


My GPG-key can be found at
http://blupp.net/~davor/davor.key
 
J

jeffc

This is all Visual C++ and Windows specific stuff. You'll have to go to the
microsoft.public newsgroups for help with that.
 
J

Jussi Jumppanen

Kevin Torr said:
This is all Visual C++ and Windows specific stuff. You'll have
to go to the microsoft.public newsgroups for help with that.

Other suitable news groups include:

comp.os.ms-windows.programmer.misc
comp.os.ms-windows.programmer.win32

Also a good C++ Win32 tutorial can be found here:

http://www.relisoft.com/win32/

Jussi Jumppanen
Author of: Zeus for Windows (All new version 3.92 out now)
"The C/C++, Java, HTML, FTP, Python, PHP, Perl programmer's editor"
Home Page: http://www.zeusedit.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Compilers c c++ 3
Help me, going live with a quiz 0
C++, SFML, SDL2 - 2D game 0
Coding going wrong 1
Boomer trying to learn coding in C and C++ 6
Become a C++ programmer 6
C++ database 0
C exercise 1

Members online

No members online now.

Forum statistics

Threads
474,171
Messages
2,570,935
Members
47,472
Latest member
KarissaBor

Latest Threads

Top