Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt Programming Language

Qt Programming Language

Scheduled Pinned Locked Moved Unsolved General and Desktop
331 Posts 17 Posters 306.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Annabelle

    @JKSH said in Qt Programming Language:

    @Annabelle said in Qt Programming Language:

    I created a new project, which took me to the editor where there was some example text, then I deleted what was there. Next, I went to the tutorial where the "Hello World" code was, and I copied the code to the clipboard. When I pressed Alt+Tab to return to the text editor in Visual Studio to paste the newly-copied code, my screenreader didn't show it (the text editor), just a blank screen.

    Could it be that the screenreader was silent because there was no text inside the editor? What happens when you try to paste the newly-copied code?

    Also, try using Ctrl+Tab to cycle between sub-windows inside Visual Studio.

    One final word of advise: Please don't wait for me (or anyone else) to reply before you take action. Take the initiative to try different things (and search on Google) to see if you can solve the problem before someone replies.

    I'm not sure why this didn't work, but I pasted the Hello World code in the text editor window, then when building the project, there were some errors. Even though I pasted the code without any changes.
    0_1540994545531_8d93dc3f-313e-41be-a836-59bb363386f9-image.png

    JonBJ Offline
    JonBJ Offline
    JonB
    wrote on last edited by JonB
    #214

    @Annabelle
    [EDIT: I have scrapped my suggestions here, read @mrjj's post below. He is right because of the error message number. You are using a .cs file extension and compiling your code as C# instead of C++ in Visual Studio. Change your filename extension to .cpp. You need to create a completely different kind of project in Visual Studio, it must be something like a "C++ project" and not a "CSharp project".]

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #215

      Hi
      Im wondering about the file extension.
      Its .cs which would indicate a c sharp program
      and not a c++ one ?
      Maybe a wrong template was used to create it ?

      JKSHJ 1 Reply Last reply
      4
      • mrjjM mrjj

        Hi
        Im wondering about the file extension.
        Its .cs which would indicate a c sharp program
        and not a c++ one ?
        Maybe a wrong template was used to create it ?

        JKSHJ Offline
        JKSHJ Offline
        JKSH
        Moderators
        wrote on last edited by
        #216

        @mrjj said in Qt Programming Language:

        Hi
        Im wondering about the file extension.
        Its .cs which would indicate a c sharp program
        and not a c++ one ?
        Maybe a wrong template was used to create it ?

        @mrjj is right; you have created a C# project instead of a C++ project. When you create a project, select "Visual C++".

        I can't remember what Visual Studio 2015 is like, but Visual Studio 2017 lets me choose Visual C++ > Windows Desktop > Windows Console Application.

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        A 1 Reply Last reply
        0
        • JKSHJ JKSH

          @mrjj said in Qt Programming Language:

          Hi
          Im wondering about the file extension.
          Its .cs which would indicate a c sharp program
          and not a c++ one ?
          Maybe a wrong template was used to create it ?

          @mrjj is right; you have created a C# project instead of a C++ project. When you create a project, select "Visual C++".

          I can't remember what Visual Studio 2015 is like, but Visual Studio 2017 lets me choose Visual C++ > Windows Desktop > Windows Console Application.

          A Offline
          A Offline
          Annabelle
          wrote on last edited by
          #217

          @JKSH said in Qt Programming Language:

          @mrjj said in Qt Programming Language:

          Hi
          Im wondering about the file extension.
          Its .cs which would indicate a c sharp program
          and not a c++ one ?
          Maybe a wrong template was used to create it ?

          @mrjj is right; you have created a C# project instead of a C++ project. When you create a project, select "Visual C++".

          I can't remember what Visual Studio 2015 is like, but Visual Studio 2017 lets me choose Visual C++ > Windows Desktop > Windows Console Application.

          Here's another screenshot. This time, I actually created a C++ project, but it still says there's an error. 0_1541007381736_537203d4-62e9-49e1-9e39-5c7e079ba05e-image.png

          JonBJ 1 Reply Last reply
          0
          • A Annabelle

            @JKSH said in Qt Programming Language:

            @mrjj said in Qt Programming Language:

            Hi
            Im wondering about the file extension.
            Its .cs which would indicate a c sharp program
            and not a c++ one ?
            Maybe a wrong template was used to create it ?

            @mrjj is right; you have created a C# project instead of a C++ project. When you create a project, select "Visual C++".

            I can't remember what Visual Studio 2015 is like, but Visual Studio 2017 lets me choose Visual C++ > Windows Desktop > Windows Console Application.

            Here's another screenshot. This time, I actually created a C++ project, but it still says there's an error. 0_1541007381736_537203d4-62e9-49e1-9e39-5c7e079ba05e-image.png

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by JonB
            #218

            @Annabelle
            This is to do with the VS/MS compiler. Paste the following line:

            #include "stdafx.h"
            

            into your file, as the first line, somewhere above your existing #include <iostream>.

            Alternatively you can remove a compiler switch (/Yu) in your VS project, but I think the above is easiest.

            A 1 Reply Last reply
            1
            • JonBJ JonB

              @Annabelle
              This is to do with the VS/MS compiler. Paste the following line:

              #include "stdafx.h"
              

              into your file, as the first line, somewhere above your existing #include <iostream>.

              Alternatively you can remove a compiler switch (/Yu) in your VS project, but I think the above is easiest.

              A Offline
              A Offline
              Annabelle
              wrote on last edited by
              #219

              @JonB said in Qt Programming Language:

              @Annabelle
              This is to do with the VS/MS compiler. Paste the following line:

              #include "stdafx.h"
              

              into your file, as the first line, somewhere above your existing #include <iostream>.

              Alternatively you remover a compiler switch (/Yu) in your VS project, but I think the above is easiest.

              What exactly is "stdafx"? Is it an initializing parameter?

              JKSHJ 1 Reply Last reply
              0
              • A Annabelle

                @JonB said in Qt Programming Language:

                @Annabelle
                This is to do with the VS/MS compiler. Paste the following line:

                #include "stdafx.h"
                

                into your file, as the first line, somewhere above your existing #include <iostream>.

                Alternatively you remover a compiler switch (/Yu) in your VS project, but I think the above is easiest.

                What exactly is "stdafx"? Is it an initializing parameter?

                JKSHJ Offline
                JKSHJ Offline
                JKSH
                Moderators
                wrote on last edited by
                #220

                @Annabelle said in Qt Programming Language:

                What exactly is "stdafx"? Is it an initializing parameter?

                You can find an answer by searching on Google or another search engine. Programmers must use search engines often, so make it a habit.

                Here is an answer: https://stackoverflow.com/questions/2976035/purpose-of-stdafx-h

                Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                1 Reply Last reply
                1
                • A Offline
                  A Offline
                  Annabelle
                  wrote on last edited by
                  #221

                  I don't know what I did wrong this time, but here's another screenshot of an error.
                  0_1541225135389_7d1ba768-18a7-4ec3-b4aa-26271bc951dc-image.png

                  JonBJ 1 Reply Last reply
                  0
                  • A Annabelle

                    I don't know what I did wrong this time, but here's another screenshot of an error.
                    0_1541225135389_7d1ba768-18a7-4ec3-b4aa-26271bc951dc-image.png

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by JonB
                    #222

                    @Annabelle
                    When you did the paste, this time you have accidentally actually copied the actual line numbers 1 to 6 onto lines 1 to 6. This is in addition to the line numbers which VS shows to the left of every line you write, and your screenreader probably reads out to you. Which means that prior to your #include at line 7 the first 6 lines are unacceptable. You need to delete, or change to blank lines, your first 6 lines.

                    When you try to compile code, the very first error is highly significant. Once the compiler hits something erroneous, very often it does not do a great a job at "recovering" from the error such that it gives sensible errors (or not) for whatever follows. So you can end up with loads of "spurious" errors after the first one. Concentrate each time on fixing whatever the very first error reported is, then try compiling again and see where it gets you.

                    Now, there is an important thing here in VS which I do not know whether you are aware of/your screenreader tells you about. When we look at the lines you have shown us in the screenshot above, we see the lines the compiler does not like having a "squiggly red underline" shown. For us we can immediately see those and know something is wrong. Does your screenreader tell you about these? In your current code, the very first line (numbered 1) has the actual text of the number 1 on it. Since that is wrong, VS squiggle-red-underlines that 1. It would be very helpful to you if your screenreader can make you aware of such lines, but perhaps it cannot? Also, I believe that if I hovered my mouse over a red-squiggle-underline VS would put up a "tooltip" giving me the error message for what is wrong: again, are you able to be informed about that?

                    A 1 Reply Last reply
                    2
                    • JonBJ JonB

                      @Annabelle
                      When you did the paste, this time you have accidentally actually copied the actual line numbers 1 to 6 onto lines 1 to 6. This is in addition to the line numbers which VS shows to the left of every line you write, and your screenreader probably reads out to you. Which means that prior to your #include at line 7 the first 6 lines are unacceptable. You need to delete, or change to blank lines, your first 6 lines.

                      When you try to compile code, the very first error is highly significant. Once the compiler hits something erroneous, very often it does not do a great a job at "recovering" from the error such that it gives sensible errors (or not) for whatever follows. So you can end up with loads of "spurious" errors after the first one. Concentrate each time on fixing whatever the very first error reported is, then try compiling again and see where it gets you.

                      Now, there is an important thing here in VS which I do not know whether you are aware of/your screenreader tells you about. When we look at the lines you have shown us in the screenshot above, we see the lines the compiler does not like having a "squiggly red underline" shown. For us we can immediately see those and know something is wrong. Does your screenreader tell you about these? In your current code, the very first line (numbered 1) has the actual text of the number 1 on it. Since that is wrong, VS squiggle-red-underlines that 1. It would be very helpful to you if your screenreader can make you aware of such lines, but perhaps it cannot? Also, I believe that if I hovered my mouse over a red-squiggle-underline VS would put up a "tooltip" giving me the error message for what is wrong: again, are you able to be informed about that?

                      A Offline
                      A Offline
                      Annabelle
                      wrote on last edited by
                      #223

                      @JonB said in Qt Programming Language:

                      @Annabelle
                      When you did the paste, this time you have accidentally actually copied the actual line numbers 1 to 6 onto lines 1 to 6. This is in addition to the line numbers which VS shows to the left of every line you write, and your screenreader probably reads out to you. Which means that prior to your #include at line 7 the first 6 lines are unacceptable. You need to delete, or change to blank lines, your first 6 lines.

                      When you try to compile code, the very first error is highly significant. Once the compiler hits something erroneous, very often it does not do a great a job at "recovering" from the error such that it gives sensible errors (or not) for whatever follows. So you can end up with loads of "spurious" errors after the first one. Concentrate each time on fixing whatever the very first error reported is, then try compiling again and see where it gets you.

                      Now, there is an important thing here in VS which I do not know whether you are aware of/your screenreader tells you about. When we look at the lines you have shown us in the screenshot above, we see the lines the compiler does not like having a "squiggly red underline" shown. For us we can immediately see those and know something is wrong. Does your screenreader tell you about these? In your current code, the very first line (numbered 1) has the actual text of the number 1 on it. Since that is wrong, VS squiggle-red-underlines that 1. It would be very helpful to you if your screenreader can make you aware of such lines, but perhaps it cannot? Also, I believe that if I hovered my mouse over a red-squiggle-underline VS would put up a "tooltip" giving me the error message for what is wrong: again, are you able to be informed about that?

                      My screenreader can't tell if an underline has a color or is squigly. It can say _ (underline). Is that the mark you're talking about? I'm confused!

                      JKSHJ 1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        Annabelle
                        wrote on last edited by
                        #224

                        Here's a screenshot of yet another error. I'm not sure what I did wrong. I deleted the lines with pasted numbers, but even Visual Studio didn't like something I did then.
                        0_1541260099015_7152e5c5-4f99-4b63-ab56-23a1c4260150-image.png

                        1 Reply Last reply
                        0
                        • A Annabelle

                          @JonB said in Qt Programming Language:

                          @Annabelle
                          When you did the paste, this time you have accidentally actually copied the actual line numbers 1 to 6 onto lines 1 to 6. This is in addition to the line numbers which VS shows to the left of every line you write, and your screenreader probably reads out to you. Which means that prior to your #include at line 7 the first 6 lines are unacceptable. You need to delete, or change to blank lines, your first 6 lines.

                          When you try to compile code, the very first error is highly significant. Once the compiler hits something erroneous, very often it does not do a great a job at "recovering" from the error such that it gives sensible errors (or not) for whatever follows. So you can end up with loads of "spurious" errors after the first one. Concentrate each time on fixing whatever the very first error reported is, then try compiling again and see where it gets you.

                          Now, there is an important thing here in VS which I do not know whether you are aware of/your screenreader tells you about. When we look at the lines you have shown us in the screenshot above, we see the lines the compiler does not like having a "squiggly red underline" shown. For us we can immediately see those and know something is wrong. Does your screenreader tell you about these? In your current code, the very first line (numbered 1) has the actual text of the number 1 on it. Since that is wrong, VS squiggle-red-underlines that 1. It would be very helpful to you if your screenreader can make you aware of such lines, but perhaps it cannot? Also, I believe that if I hovered my mouse over a red-squiggle-underline VS would put up a "tooltip" giving me the error message for what is wrong: again, are you able to be informed about that?

                          My screenreader can't tell if an underline has a color or is squigly. It can say _ (underline). Is that the mark you're talking about? I'm confused!

                          JKSHJ Offline
                          JKSHJ Offline
                          JKSH
                          Moderators
                          wrote on last edited by JKSH
                          #225

                          @Annabelle said in Qt Programming Language:

                          My screenreader can't tell if an underline has a color or is squigly. It can say _ (underline). Is that the mark you're talking about?

                          In your latest screenshot, there was a red squiggly line underneath "#include". Did your screenreader announce that? If not, don't worry -- the error is repeated under the Error List pane: "cannot open source Hello World! file "stdafx.h". Did your screenreader announce that?

                          @Annabelle said in Qt Programming Language:

                          Here's a screenshot of yet another error.

                          Change <stdafx.h> to "stdafx.h". In other words, change the angular brackets to double quotation marks.

                          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                          A 1 Reply Last reply
                          0
                          • JKSHJ JKSH

                            @Annabelle said in Qt Programming Language:

                            My screenreader can't tell if an underline has a color or is squigly. It can say _ (underline). Is that the mark you're talking about?

                            In your latest screenshot, there was a red squiggly line underneath "#include". Did your screenreader announce that? If not, don't worry -- the error is repeated under the Error List pane: "cannot open source Hello World! file "stdafx.h". Did your screenreader announce that?

                            @Annabelle said in Qt Programming Language:

                            Here's a screenshot of yet another error.

                            Change <stdafx.h> to "stdafx.h". In other words, change the angular brackets to double quotation marks.

                            A Offline
                            A Offline
                            Annabelle
                            wrote on last edited by
                            #226

                            @JKSH said in Qt Programming Language:

                            @Annabelle said in Qt Programming Language:

                            My screenreader can't tell if an underline has a color or is squigly. It can say _ (underline). Is that the mark you're talking about?

                            In your latest screenshot, there was a red squiggly line underneath "#include". Did your screenreader announce that? If not, don't worry -- the error is repeated under the Error List pane: "cannot open source Hello World! file "stdafx.h". Did your screenreader announce that?

                            @Annabelle said in Qt Programming Language:

                            Here's a screenshot of yet another error.

                            Change <stdafx.h> to "stdafx.h". In other words, change the angular brackets to double quotation marks.

                            It seems that when I type #include "stdafx.h", the quotation marks, for some reason, are automatically changed to angular brackets (<>). How do I prevent that from happening?

                            1 Reply Last reply
                            0
                            • A Offline
                              A Offline
                              Annabelle
                              wrote on last edited by
                              #227

                              How's this?

                              0_1541379728064_097a0365-c849-4c61-a942-b48351b6e910-image.png

                              JonBJ 1 Reply Last reply
                              0
                              • A Annabelle

                                How's this?

                                0_1541379728064_097a0365-c849-4c61-a942-b48351b6e910-image.png

                                JonBJ Offline
                                JonBJ Offline
                                JonB
                                wrote on last edited by JonB
                                #228

                                @Annabelle
                                This looks fault-free, and seems to have run without error! I don't know where the "Hello world" output went though? On that Output tab you have the Show output from combobox set to Debug, you may have to set that to something else to see/hear the program output?

                                A 1 Reply Last reply
                                2
                                • JonBJ JonB

                                  @Annabelle
                                  This looks fault-free, and seems to have run without error! I don't know where the "Hello world" output went though? On that Output tab you have the Show output from combobox set to Debug, you may have to set that to something else to see/hear the program output?

                                  A Offline
                                  A Offline
                                  Annabelle
                                  wrote on last edited by
                                  #229

                                  @JonB said in Qt Programming Language:

                                  @Annabelle
                                  This looks fault-free, and seems to have run without error! I don't know where the "Hello world" output went though? On that Output tab you have the Show output from combobox set to Debug, you may have to set that to something else to see/hear the program output?

                                  How do I do that, I wonder? After I make the "Hello World" program, what do I do next?

                                  JonBJ JKSHJ 2 Replies Last reply
                                  0
                                  • A Annabelle

                                    @JonB said in Qt Programming Language:

                                    @Annabelle
                                    This looks fault-free, and seems to have run without error! I don't know where the "Hello world" output went though? On that Output tab you have the Show output from combobox set to Debug, you may have to set that to something else to see/hear the program output?

                                    How do I do that, I wonder? After I make the "Hello World" program, what do I do next?

                                    JonBJ Offline
                                    JonBJ Offline
                                    JonB
                                    wrote on last edited by
                                    #230

                                    @Annabelle
                                    Ignore my comment about the Debug tab, I think. The question is: when you run the program, it should output Hello world!, where does that output go to? Does it maybe open a console window, send it there, and then close it as soon as your program finishes, all of which would be near "instantaneous"? It may depend on your project type, I don't know. You may need hep on this from VS C++ people here....

                                    A 1 Reply Last reply
                                    0
                                    • A Annabelle

                                      @JonB said in Qt Programming Language:

                                      @Annabelle
                                      This looks fault-free, and seems to have run without error! I don't know where the "Hello world" output went though? On that Output tab you have the Show output from combobox set to Debug, you may have to set that to something else to see/hear the program output?

                                      How do I do that, I wonder? After I make the "Hello World" program, what do I do next?

                                      JKSHJ Offline
                                      JKSHJ Offline
                                      JKSH
                                      Moderators
                                      wrote on last edited by
                                      #231

                                      @Annabelle said in Qt Programming Language:

                                      @JonB said in Qt Programming Language:

                                      @Annabelle
                                      I don't know where the "Hello world" output went though? On that Output tab you have the Show output from combobox set to Debug, you may have to set that to something else to see/hear the program output?

                                      How do I do that, I wonder?

                                      When you run your program (Ctrl + F5), a window should pop up and that window should contain the words "Hello world!". The window will close if you press any key while the window has focus.

                                      Did JAWS read the contents of that window to you?

                                      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                                      1 Reply Last reply
                                      2
                                      • JonBJ JonB

                                        @Annabelle
                                        Ignore my comment about the Debug tab, I think. The question is: when you run the program, it should output Hello world!, where does that output go to? Does it maybe open a console window, send it there, and then close it as soon as your program finishes, all of which would be near "instantaneous"? It may depend on your project type, I don't know. You may need hep on this from VS C++ people here....

                                        A Offline
                                        A Offline
                                        Annabelle
                                        wrote on last edited by
                                        #232

                                        @JonB said in Qt Programming Language:

                                        @Annabelle
                                        Ignore my comment about the Debug tab, I think. The question is: when you run the program, it should output Hello world!, where does that output go to? Does it maybe open a console window, send it there, and then close it as soon as your program finishes, all of which would be near "instantaneous"? It may depend on your project type, I don't know. You may need hep on this from VS C++ people here....

                                        This is what the output window looks like in a screenshot. 0_1541609206448_6d656a50-ae21-4c35-b9e3-89f42a2c7ce5-image.png
                                        What is the meaning of this message?
                                        "The program '[2880] Hello World!.exe' has exited with code 0 (0x0)."

                                        JonBJ 1 Reply Last reply
                                        0
                                        • A Annabelle

                                          @JonB said in Qt Programming Language:

                                          @Annabelle
                                          Ignore my comment about the Debug tab, I think. The question is: when you run the program, it should output Hello world!, where does that output go to? Does it maybe open a console window, send it there, and then close it as soon as your program finishes, all of which would be near "instantaneous"? It may depend on your project type, I don't know. You may need hep on this from VS C++ people here....

                                          This is what the output window looks like in a screenshot. 0_1541609206448_6d656a50-ae21-4c35-b9e3-89f42a2c7ce5-image.png
                                          What is the meaning of this message?
                                          "The program '[2880] Hello World!.exe' has exited with code 0 (0x0)."

                                          JonBJ Offline
                                          JonBJ Offline
                                          JonB
                                          wrote on last edited by JonB
                                          #233

                                          @Annabelle

                                          "The program '[2880] Hello World!.exe' has exited with code 0 (0x0)."

                                          It's just Visual Studio letting you know good news! It's telling you that you just ran your program executable (Hello World!.exe), it ran to completion and exited, and it returned an "exit code" of 0 (which is good, is what your code does, but which you don't care about).

                                          My question still remains, however. When that program ran it sent the string Hello World! to its "output" (that's the purpose of this program). Where did that "output" go? (I don't use Visual Studio, and with your project type, so I don't know. @JKSH said earlier:

                                          When you run your program (Ctrl + F5), a window should pop up and that window should contain the words "Hello world!". The window will close if you press any key while the window has focus.
                                          Did JAWS read the contents of that window to you?

                                          So how does this behave for you? Did you get to hear about that output? Did you press a key to close a window which had opened?

                                          A 1 Reply Last reply
                                          1

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved