Viewing 20 posts - 21 through 40 (of 259 total)
  • Author
    Posts
  • #31109
    Wheels-Of-FireWheels-Of-Fire
    Participant
      @grahamdearsley
      Forumite Points: 4

      I think he has a point about separating computer science from programming .  Blue sky from useful ?

      #31116
      Ed PEd P
      Participant
        @edps
        Forumite Points: 39

        Try ‘overloading functions’ rather than rewriting/templating it often covers a multitude of sins. (I personally think that it makes it harder to read!)

        link

        #31118
        Wheels-Of-FireWheels-Of-Fire
        Participant
          @grahamdearsley
          Forumite Points: 4

          Ah yes you can. But with classes forming containers for types I want to know what happens inside them. Call me nosey ?

          Anyway getting the book ?

          #31356
          Wheels-Of-FireWheels-Of-Fire
          Participant
            @grahamdearsley
            Forumite Points: 4

            https://docs.microsoft.com/en-us/cpp/windows/walkthrough-creating-windows-desktop-applications-cpp

            At last. A nice clear explanation of how to properly open a desktop window using just C/C++ and the Windows API.

            #31357
            Wheels-Of-FireWheels-Of-Fire
            Participant
              @grahamdearsley
              Forumite Points: 4

              The only error in the above that I can find is that you can’t start with an empty project and include the precompiled header at the same time. Just start with the empty project.

              #31385
              Wheels-Of-FireWheels-Of-Fire
              Participant
                @grahamdearsley
                Forumite Points: 4

                Please forgive me if i have been a bit slow but this only just sunk in.

                Calling methods in C is the same as calling a function.

                In C++ you can call a class or a function and they make a clear distinction. Saying you called a method usually means you called function.

                In the Microsoft docs they just call either a method.

                #31386
                Wheels-Of-FireWheels-Of-Fire
                Participant
                  @grahamdearsley
                  Forumite Points: 4

                  Oh yes, I am really inviting comments about that ?

                  #32296
                  Wheels-Of-FireWheels-Of-Fire
                  Participant
                    @grahamdearsley
                    Forumite Points: 4

                    Just getting a few things straight in my head. See what you think about the following statements.

                    C++ treats classes as a user defined data type.

                    The standard library contains a few very usefull data types such as <vector> that are implemented as classes.

                    Classes such as <vector> contain their own functions that you can access using dot notation as in:

                    vector<int>MyVector;

                    int Data=5;

                    MyVector.push_back( Data);

                    Push back is a function in the vector class.

                    Comments welcome please ?

                    #32322
                    Wheels-Of-FireWheels-Of-Fire
                    Participant
                      @grahamdearsley
                      Forumite Points: 4

                      Speaking of vectors, they really are. A “vector” is really just an Array of indexes that point to, or vector to, a data structure and that can be a class. Remember a class is data type as far as C++ is concerned.

                      As always open for comments ?

                      #32620
                      Wheels-Of-FireWheels-Of-Fire
                      Participant
                        @grahamdearsley
                        Forumite Points: 4

                        Having now got to chapter 9 in Bjarne Stroustrup’s  book “Programming Principles and Practice Using C++” I am going to Highly recommend it. The book reads almost like a story with everything in the right order. There is very little referring  back and forth. If something in a previous chapter is used again it is often repeated again in a different context as a memory aid. This is by no means a beginner only book and a programmer  experienced in another language, even plain C, will find it highly useful.

                        Anyway enough praise, back to the book ?

                        #32749
                        Wheels-Of-FireWheels-Of-Fire
                        Participant
                          @grahamdearsley
                          Forumite Points: 4

                          I have found a small but massively annoying fault with Mr Stroustrup’s book.

                          I was pleasantly surprised to see that he devotes 4 chapters to graphics programming and thought it would be a useful extra. It turns out that he actually uses graphics programming as a major part of his explination of objects.

                          The trouble is he has chosen to use the Fast Light Tool Kit ( fltk pronounced full tick) library and left it as an exercise to the reader to set it up.

                          Try as i might I can not ! The internet is full of people reading the same book with the same problem.

                          I have got further than most because I have managed to get all the library’s installed under Visual Studio but I am still stuck with 1 linker error relating to wsock.lib. the linker can’t find it.

                          I cant see what fltk would want with windows sockets and anyway isn’t that a Microsoft library ?

                          Anyone else know what im talking about ?

                          #32752
                          Ed PEd P
                          Participant
                            @edps
                            Forumite Points: 39

                            I guess you looked at Sourceforge. link

                            However it is probably better to look at the latest project updates on Github,

                            Don’t forget to read the README.Windows.txt

                            #32755
                            Wheels-Of-FireWheels-Of-Fire
                            Participant
                              @grahamdearsley
                              Forumite Points: 4

                              Yep had a fairly good look through those and you got closer than me !

                              There is a lot relating to fltk on Linux but almost bugger all on windows.

                              I tried just removing wsock.lib from the Linker input but then it cant find kenl32.lib so it looks like I am not linking to ANY Microsoft library.

                              #32756
                              Wheels-Of-FireWheels-Of-Fire
                              Participant
                                @grahamdearsley
                                Forumite Points: 4

                                Slap me with a wet kipper !

                                Someone(couldnt be me) had unticked the inherit from project box ?

                                Back to the book then.

                                By the way, fltk only needs wsock.lib to be compatible with W95. Works just fine without it on W10.

                                #32831
                                Wheels-Of-FireWheels-Of-Fire
                                Participant
                                  @grahamdearsley
                                  Forumite Points: 4

                                  https://bumpyroadtocode.com/2017/08/29/how-to-install-and-use-fltk-1-3-4-in-visual-studio-2017-complete-guide-2-0-no-cross-contamination/

                                  I put the link at the top because I had trouble posting it and I didn’t want to lose my typing ?.

                                  There is a more serious fault with Mr Stroustrups book.

                                  At the very beginning he defines a custom header file that is to be included with all code examples up to chapter 20.

                                  The header includes common library files like <iostream> and <vector> so the student doesn’t have to and it also handles common errors and exceptions.

                                  The header is called std_lib_facilities.h and I haven’t been using it because I already know how to do what it does.

                                  The problem comes in the chapters dealing with graphics because the main Window.h class he has written for the examples relies on code in std_lib_facilities.h

                                  std_lib_facilities.h is a dodo.

                                  It includes macros that Visual Studio says are out of date but compiles anyway and then it has a macro that redefines the std vector as Vector which later causes a “Vector is not a member of std:”  when it tries to use vector.

                                  I have not been able to do any of the graphics exercises because of this and it is a major part of the book.

                                  If anyone else fancies giving it a go the instructions and a link to the evil header are in the link above.

                                  At least the walk through for installing fltk works so it may be worth a look.

                                  #32832
                                  Wheels-Of-FireWheels-Of-Fire
                                  Participant
                                    @grahamdearsley
                                    Forumite Points: 4

                                    Oh yeh. The error is a compiler error and just commenting out the macro causes a host of other errors instead.

                                    #32840
                                    Wheels-Of-FireWheels-Of-Fire
                                    Participant
                                      @grahamdearsley
                                      Forumite Points: 4

                                      I now have a more recent and less evil copy of std_lib_facilities.h

                                      The warnings about out of date macros are gone and on its own it works, even with a short program that uses a vector.

                                      There is still a #define vector Vector line in there though and Window.h still throws up “Vector is not a member of std.

                                      That Vector def is there to get a range checked vector but it is not needed with VS 2017 because vectors are now range checked during a debug build anyway.

                                      I tried putting a #define Vecror vector in Window.h but it caused more errors.

                                      Stuck now.

                                      #32843
                                      Wheels-Of-FireWheels-Of-Fire
                                      Participant
                                        @grahamdearsley
                                        Forumite Points: 4

                                        I am just going to have to read the graphics chapters without doing the examples. It is not possible to just skip ahead because those chapters introduce base classes and inheritance and it is not possible to get the example libraries working.

                                        Consider my recommendation for this book withdrawn ?

                                        #32844
                                        Ed PEd P
                                        Participant
                                          @edps
                                          Forumite Points: 39

                                          I do not know how usable it is but this Physics library has a very impressive demo!

                                          #32846
                                          Wheels-Of-FireWheels-Of-Fire
                                          Participant
                                            @grahamdearsley
                                            Forumite Points: 4

                                            Looks interesting and I will give it a go at some point but it is for C# and uses the .NET framework.

                                            At the moment I only have C++ installed under Visual Studio. I am making my life difficult by learning to write unmanaged code first ?

                                          Viewing 20 posts - 21 through 40 (of 259 total)
                                          • You must be logged in to reply to this topic.