• Lucid Dreaming - Dream Views




    Results 1 to 22 of 22
    1. #1
      Christian youssarian's Avatar
      Join Date
      Dec 2007
      Gender
      Location
      Independence, Kansas
      Posts
      441
      Likes
      41

      Is It Really That Complex to Add a C++ Library?

      Wow, OK. I'm fairly adept with C++ and I want to download a graphics library, or at least find a tutorial to learn how to use C++'s built-in graphics commands, if it has any. I'm interested in learning how to make simple, 2D graphics like shapes and colors and whatnot. But it seems that whenever I browse through a site for such a type of library they always seem to say that I have to run "make" commands and download more stuff to get it to work on specific machines and I have to run commands on DOS.

      Is it really that difficult? I'd imagine that I would need to do is stick a bunch of .h and .cpp files into the appropriate folders and the commands would be available.

      I use Turbo C++ 4.5, an old but useful program, which I got from my computers teacher in high school. It lets me make and edit files, highlighting text in the current file and various other things - which I believe means it's an IDE. It also has a compiler built in. It is made by Borland International.

    2. #2
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935
      I recommend using GCC instead, Borland is a nightmare.

      The library that you want is called OpenGL. It's always downloaded precompiled, because compiling it takes several hours. It's a MONSTEROUS library, but it's broken up so if you add it statically (which you should,) you only get what you need added to it.

      C++ has no built-in graphics commands, it can't, it's designed to be cross-platform.

      OpenGL is technically a C library, because it's old, cross language, and fast as hell. So you don't get the C++ advantages of templates, classes and such, but you can "C++"-ize it.

      Code:
      struct glBeginner{
         glBeginner(GLenum mode){
            glBegin(mode);
         }
         ~glBeginner(void){
            glEnd();
         }
      };
      
      void MakeTriangle(void){
         glBeginner scope(GL_LINES);
         glVertex3i(0, 0);
         glVertex3i(100, 0);
         glVertex3i(50, 50);
      }


      BTW, "make" should NEVER be done in DOS, it should be done in Cygwin, because make files are designed for *nix.

    3. #3
      Christian youssarian's Avatar
      Join Date
      Dec 2007
      Gender
      Location
      Independence, Kansas
      Posts
      441
      Likes
      41
      Quote Originally Posted by ninja9578 View Post
      so if you add it statically (which you should,)
      Add statically? What does that mean?

      Quote Originally Posted by ninja9578 View Post
      templates
      Now you're just making me use Google more.

      Quote Originally Posted by ninja9578 View Post
      BTW, "make" should NEVER be done in DOS, it should be done in Cygwin, because make files are designed for *nix.
      Yep, I can put that with the rest of the information I didn't know.

      Wait, is this something I can just go ahead and download off the internet, or is there more to it than just that?
      Last edited by youssarian; 12-25-2009 at 11:46 PM.

    4. #4
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935
      Quote Originally Posted by youssarian View Post
      Add statically? What does that mean?
      There are two ways to link a library, statically and dynamically. Statically means that the executable will have the library embedded into it. A dynamic library is one that is separate from the executable and loaded when needed. On Windows it's got a dll extension. If you're doing a lot of graphics, you should add it statically because you have to load it before anything happens anyway.


      Now you're just making me use Google more.
      Templates are very very important to C++. It's good to lean how to use them. You don't have to, professionally, I rarely use templates, but there are times where there is no other way.


      Yep, I can put that with the rest of the information I didn't know.

      Thanks!
      Cygwin is a Unix terminal for Windows. It gives you a real terminal, where-as DOS is a little kiddie terminal by comparison.

    5. #5
      khh
      khh is offline
      Remember Achievements:
      1000 Hall Points Veteran First Class
      khh's Avatar
      Join Date
      Jun 2009
      Gender
      Location
      Norway
      Posts
      2,482
      Likes
      1309
      Quote Originally Posted by ninja9578 View Post
      Cygwin is a Unix terminal for Windows. It gives you a real terminal, where-as DOS is a little kiddie terminal by comparison.
      Cygwin will link all your files with cygwin1.dll though, to provide Unix functionality. And there is a makefile tool for windows, nmake. Though you do need a custom makefile. Also, powershell is actually a pretty good windows terminal, though I can't be arsed to learn it.
      April Ryan is my friend,
      Every sorrow she can mend.
      When i visit her dark realm,
      Does it simply overwhelm.

    6. #6
      FBI agent Ynot's Avatar
      Join Date
      Oct 2005
      Gender
      Location
      Southend, Essex
      Posts
      4,337
      Likes
      14
      Code:
      ./configure
      make
      sudo make install
      done
      (\_ _/)
      (='.'=)
      (")_(")

    7. #7
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935
      Quote Originally Posted by khh View Post
      And there is a makefile tool for windows, nmake. Though you do need a custom makefile.
      Then what good is that? make files are designed for UNIX based systems. If you're making an nmake file, it will ONLY work on Windows, and that's not the point of a make file.

    8. #8
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935
      This is a good forum for C++. It's supposed to be for professionals, but students creep in every once in a while... especially during finals week for some reason
      http://www.codeguru.com/forum/forumdisplay.php?f=9

    9. #9
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935
      Quote Originally Posted by youssarian View Post
      Wait, is this something I can just go ahead and download off the internet, or is there more to it than just that?
      I didn't see this. Yes, OpenGL is free and comes precompiled, you can download it off of the web. Not sure if you can get the 3.2 API, Windows is near the bottom of the importance of porting. Should be able to get 3.0 though.

    10. #10
      The 'stache TweaK's Avatar
      Join Date
      Jul 2006
      Location
      The Netherlands
      Posts
      1,979
      Likes
      12
      I thought you said you were adept at C++...

    11. #11
      Christian youssarian's Avatar
      Join Date
      Dec 2007
      Gender
      Location
      Independence, Kansas
      Posts
      441
      Likes
      41
      I could have been overestimating my skills.

    12. #12
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935
      Quote Originally Posted by TweaK View Post
      I thought you said you were adept at C++...
      Quote Originally Posted by youssarian View Post
      I could have been overestimating my skills.
      Don't second guess yourself. I'm a professional C++ programmer and it took me 3 days to figure out how to compile wxWidgets. As in 3 full work days.

      Linux is by far the easiest for this: Ynot's 3 lines will install any package. Doing it on Mac OSX is very difficult, Windows is an absolute nightmare.
      Last edited by ninja9578; 12-27-2009 at 08:25 PM.

    13. #13
      khh
      khh is offline
      Remember Achievements:
      1000 Hall Points Veteran First Class
      khh's Avatar
      Join Date
      Jun 2009
      Gender
      Location
      Norway
      Posts
      2,482
      Likes
      1309
      Quote Originally Posted by ninja9578 View Post
      Linux is by far the easiest for this: Ynot's 3 lines will install any package. Doing it on Mac OSX is very difficult, Windows is an absolute nightmare.
      Linux is super easy when it works. Which it doesn't always do.

      Also, some projects include a MSVC project file, which makes it very easy to compile, if still difficult to actually install.
      April Ryan is my friend,
      Every sorrow she can mend.
      When i visit her dark realm,
      Does it simply overwhelm.

    14. #14
      FBI agent Ynot's Avatar
      Join Date
      Oct 2005
      Gender
      Location
      Southend, Essex
      Posts
      4,337
      Likes
      14
      Quote Originally Posted by khh View Post
      Linux is super easy when it works. Which it doesn't always do.
      Errr... what?
      when doesn't anything work?
      (\_ _/)
      (='.'=)
      (")_(")

    15. #15
      The 'stache TweaK's Avatar
      Join Date
      Jul 2006
      Location
      The Netherlands
      Posts
      1,979
      Likes
      12
      Quote Originally Posted by Ynot View Post
      Errr... what?
      when doesn't anything work?
      Right now, my iPhone doesn't work. Which is why I got a Nokia N900, but that's a different story.

    16. #16
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935
      iPhones don't run Linux, they run standard UNIX. What does that have to do with C++ libraries though? iPhone programs are written in Cocoa.


      Something that I just remembered: Download and install Dev-C++. It's a deprecated IDE, but it's got something called dev-packs, which are sort of like dev-packs on Linux. Dev-C++ will automatically configure and install them for you. That's how I eventually got wxWidgets to work on my machine. Don't use it as an IDE, but it's package management is a very powerful tool.

    17. #17
      The 'stache TweaK's Avatar
      Join Date
      Jul 2006
      Location
      The Netherlands
      Posts
      1,979
      Likes
      12
      Haha.

      For one, iPhones don't run "standard UNIX". They run iPhone OS, which is based on unix, but not standard UNIX.

      It has nothing to do with C++ libraries. He asked "when doesn't anything work", though, and I responded that my iPhone didn't work. I could've just as well said my vacuum cleaner doesn't work, because it wasn't a serious reply.

    18. #18
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935
      iPhone OS is standard UNIX. The latest UNIX standard is called UNIX '03, all Apple Operating systems are compliant with that standard.

    19. #19
      The 'stache TweaK's Avatar
      Join Date
      Jul 2006
      Location
      The Netherlands
      Posts
      1,979
      Likes
      12
      I must admit I'm not very well informed on this particular subject, so you could very well be right. I don't care much for Apple products (granted I did like my iPhone and the iPod is a decent product, not accounting for the marketing which is obviously great) nor this particular nitpicking argument.

    20. #20
      Member L815's Avatar
      Join Date
      Mar 2008
      Gender
      Posts
      78
      Likes
      0
      There's also Mingw + msys.

      Mingw ports the gcc tools natively in comparison to cygwin which relies on their libs to port. Msys will provide the same functionality but for make.
      http://i30.tinypic.com/j79u05.jpg

    21. #21
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935
      MinGW is what I use on Windows.

    22. #22
      Member Stalker's Avatar
      Join Date
      Nov 2003
      Location
      Lund
      Posts
      407
      Likes
      1
      Quote Originally Posted by ninja9578 View Post
      Cygwin is a Unix terminal for Windows. It gives you a real terminal, where-as DOS is a little kiddie terminal by comparison.
      Just to make one thing clear: cmd.exe is definately not DOS in any way, shape or form. And if you want a real CLI for Windows you use PowerShell anyway.
      "Trust is a weakness"
      I have a kitty. It's serial number is: 13816
      Oxeye Games

    Bookmarks

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •