Qt Programming Language
-
@jsulm said in Qt Programming Language:
@Annabelle Did you try the link I posted?
Yes. First it failed, then when I switched from my thumb drive to a backup hard drive and tried again, it succeeded!
-
@jsulm said in Qt Programming Language:
@Annabelle Did you try the link I posted?
Yes. And now when I try to compile my "Hello World" project, I get this error.
What did I do wrong? -
@Annabelle said in Qt Programming Language:
And now when I try to compile my "Hello World" project, I get this error.
The error says that your compiler is too old and it doesn't support the C++ 2011 standard. But I'm confused: If you're doing a basic C++ Hello World program, why is Code::Blocks trying to include Qt?
I suggest you leave Qt out for now. Just focus on learning plain C++. This way, it doesn't matter if you have an old compiler.
-
@JKSH said in Qt Programming Language:
@Annabelle said in Qt Programming Language:
And now when I try to compile my "Hello World" project, I get this error.
The error says that your compiler is too old and it doesn't support the C++ 2011 standard. But I'm confused: If you're doing a basic C++ Hello World program, why is Code::Blocks trying to include Qt?
I suggest you leave Qt out for now. Just focus on learning plain C++. This way, it doesn't matter if you have an old compiler.
Now when I compile a project, with regular C++ code, here's what I got in return.
-
@Annabelle
It looks like you have progressed! It seems to be successfully rubnning yourgcc
compiler.You should open up your
Sources
folder in the left-hand pane so that we can see what file(s) you have. And perhaps open your main/only.cpp
source file into the right-hand pane so that we can see that too.The error message indicates that some
.cpp
source file has an "odd" character in it, on line #9. The sort of stray character that perhaps got in there from a mis-typing. -
@Annabelle said in Qt Programming Language:
Now when I compile a project, with regular C++ code, here's what I got in return.
The error message is "stray '\240' in program". This means your .cpp file contains a character that the compiler does not accept.
'\240' is a specially-formatted character that represents a space. It can appear when someone copies code from a website or a program like Microsoft Word, and then pastes it into their IDE.
Your compiler says that the error is in line 9. I suggest you completely erase lines 8 to 10 to get rid of the '\240' character, and then re-type those lines by hand.
-
@JKSH said in Qt Programming Language:
@Annabelle said in Qt Programming Language:
Now when I compile a project, with regular C++ code, here's what I got in return.
The error message is "stray '\240' in program". This means your .cpp file contains a character that the compiler does not accept.
'\240' is a specially-formatted character that represents a space. It can appear when someone copies code from a website or a program like Microsoft Word, and then pastes it into their IDE.
Your compiler says that the error is in line 9. I suggest you completely erase lines 8 to 10 to get rid of the '\240' character, and then re-type those lines by hand.
What's the \240 character? I'm confused on that one!
-
@Annabelle said in Qt Programming Language:
What's the \240 character? I'm confused on that one!
As I mentioned before, it is a specially-formatted character that represents a space.
There are many ways to represent text: Sighted people draw lines to represent a character, Braille users arrange dot patterns to represent a character, while computers use a number to represent a character. For example, computers represent 'A' as the number 65, 'B' as the number 66, and so on.
In computers, there are multiple ways to represent a space. \240 is one such representation. Unfortunately, this representation causes problems for your compiler when it is pasted into your IDE.
Since it is a space character, I doubt that your screenreader will read it out. Sighted people can't see the bad character on the screen either.
The easiest thing to do is to erase the offending line from your code and re-type the whole line by hand.
-
@JKSH said in Qt Programming Language:
@Annabelle said in Qt Programming Language:
What's the \240 character? I'm confused on that one!
As I mentioned before, it is a specially-formatted character that represents a space.
There are many ways to represent text: Sighted people draw lines to represent a character, Braille users arrange dot patterns to represent a character, while computers use a number to represent a character. For example, computers represent 'A' as the number 65, 'B' as the number 66, and so on.
In computers, there are multiple ways to represent a space. \240 is one such representation. Unfortunately, this representation causes problems for your compiler when it is pasted into your IDE.
Since it is a space character, I doubt that your screenreader will read it out. Sighted people can't see the bad character on the screen either.
The easiest thing to do is to erase the offending line from your code and re-type the whole line by hand.
I typed the offending line by hand, and here's what I got.
-
@Annabelle Looks good, it works
-
@Annabelle said in Qt Programming Language:
not sure Qt is a Programming Language, maybe this was already discussed, hard to know when topic has 300+ posts...
It looks like the OP never created a new thread and asked all his questions in the same one. -
@jsulm said in Qt Programming Language:
@Annabelle Looks good, it works
Cool-ee-o! So what do I do next?
-
@Annabelle: Congrats, your program is compiling and running.
However, it does not seem to output any useful yet.
So the next thing would be to actually make your program to output "Hello World!" (or any other greeting you can think of).
Good luck!
-
@aha_1980 said in Qt Programming Language:
@Annabelle: Congrats, your program is compiling and running.
However, it does not seem to output any useful yet.
So the next thing would be to actually make your program to output "Hello World!" (or any other greeting you can think of).
Good luck!
Isn't that what the line, "std::cout << "Hello, World!"; is supposed to do? I'm confused!
-
Hi @Annabelle,
Isn't that what the line, "std::cout << "Hello, World!"; is supposed to do? I'm confused!
Yes, it is. Do you have this output somewhere on your screen? In the screenshots you provided, I didn't see it.
If you already have that, then the next steps could be:
- Print "Hello World" ten times, with an upcounting number appended, like:
Hello World 1 Hello World 2 Hello World 3 ... Hello World 10
- Ask the user for his name, and greet him. That could look like this:
Hello, what's your name? Luke Nice to meet you, Luke!
That would then almost be a complete program, taking an input and providing an output. Only the data processing is missing - but we can add that later.
Regards
-
@Annabelle
Hi Annabelle.Isn't that what the line, "std::cout << "Hello, World!"; is supposed to do? I'm confused!
As I mentioned earlier, we cannot see your source code in the screenshots. You need to open your source file so that we at least can see its contents.
If you were currently editing your
.cpp
file's content, I assume you have to have it open, e.g. so your screen reader can read its content. Can you get to that state and post screenshot? -
@JonB said in Qt Programming Language:
@Annabelle
Hi Annabelle.Isn't that what the line, "std::cout << "Hello, World!"; is supposed to do? I'm confused!
As I mentioned earlier, we cannot see your source code in the screenshots. You need to open your source file so that we at least can see its contents.
If you were currently editing your
.cpp
file's content, I assume you have to have it open, e.g. so your screen reader can read its content. Can you get to that state and post screenshot?How's this?
-
@JonB said in Qt Programming Language:
@Annabelle
Hi Annabelle.Isn't that what the line, "std::cout << "Hello, World!"; is supposed to do? I'm confused!
As I mentioned earlier, we cannot see your source code in the screenshots. You need to open your source file so that we at least can see its contents.
If you were currently editing your
.cpp
file's content, I assume you have to have it open, e.g. so your screen reader can read its content. Can you get to that state and post screenshot?How about this one.