Thread: New to use of C/C++ Library

  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    5

    New to use of C/C++ Library

    Hi guys,

    I'm very new to C/C++ libraries. I know the syntaxes of c/c++, like how to declare classes,pointers array etc.

    But when it comes down to using the libraries , i totally suck at it.

    I am using Microsoft visual studio 8 (or 2005).

    There are some questions which i hope you guys can help me out :

    1. Does C++ have different standard libraries? Since microsoft provided them, wouldn't they be the same for everyone? Such as for Java, everyone has the same JDK

    2. I've searched for C++ standard library, they include stuff like cmath and iterators. However I also discovered there are header files like :

    #include <windows.h>
    #include <stdio.h>
    #include <winuser.h>
    #include <windowsx.h>
    which are used in a simple keylogger,

    I couldnt find these in the Standard Library reference, the problem now is how do i find the references to these classes?



    It's really difficult to start with the library, I mean there are so many stuff out there but so hard to locate them. Does anyone know of any resource which can slowly guide me? I know I could Google it, but most of the searched that come out does not help at all..

    Thanks

  2. #2
    Registered User
    Join Date
    Oct 2006
    Location
    Canada
    Posts
    1,243
    well C and C++ are extremely popular, so i know google will give an overwhelming number of very good resources for it. if you dont want to look far, there are tutorials, etc on this site, cprogramming.com (on the main page, left menu).

    1. Does C++ have different standard libraries? Since microsoft provided them, wouldn't they be the same for everyone? Such as for Java, everyone has the same JDK
    C and C++ libraries/headers are different, yet most of the C libraries are ported to C++ in the STL (for example math.h in C would be cmath in C++). the libraries that come with your compiler (VS2005 in your case) arent necessarily available on everyone elses machine, only the STL libraries that it should have included, which is the purpose of STL. as for java, everyone uses the same JDK/SDK because java runs on a virtual machine (JVM), which is very different from using C or C++ (or any other language).
    2. I've searched for C++ standard library, they include stuff like cmath and iterators. However I also discovered there are header files like :

    #include <windows.h>
    #include <stdio.h>
    #include <winuser.h>
    #include <windowsx.h>
    the header files ending with '.h' are C headers, C++ usually doesnt use any extension for the includes. from the list of headers you have, only 'stdio.h' would be the 'real' C header thats standard. the others limit your program (ie can only run on windows).

    learning C and learning C++ are quite different, i think, mainly because C++ is object-oriented.
    the best way to learn is to read and do lots of tutorials.

  3. #3
    Registered User
    Join Date
    Dec 2007
    Posts
    5
    oh.. thanks for the reply.. i'll go check the tutorials out

  4. #4
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    All standard C libraries are the same on every C compiler, and all standard C++ library is the same on every C++ compiler... They're obviously implemented differently under the covers, but their observable effect and their usage is the same.

    Many compilers (especially Microsoft) like to add extra libraries in addition to the standard ones, so here are the standard C & C++ libraries: http://www.cppreference.com/

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > which are used in a simple keylogger,
    Please read the forum rules. I've already removed one person from the board for posting a keylogger.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Registered User
    Join Date
    Dec 2007
    Posts
    5
    Cool. Thanks all. I shall abide by the rules, no worries =)

    I've just used Stack from the c++ STL. pretty excited to try out the rest of the library.


    So now, I am actually using the Microsoft VS 2005. It actually provides an extension library to the standard library right? Can anyone direct me to the link for that page for reference of the library extension (such as http://www.cppreference.com/)? I know I can google it but microsoft's msdn website is really confusing to navigate.

    Thanks again for your kind help

  7. #7
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    There are two things to note:
    1) Windows.h is a header from the Platform SDK - Windows only. Required to use things such as windows, and win32 api.
    2) The extension library, while standard, is not implemented on all compilers so you might get (somewhat) unportable code. Still, if you can use it, I recommend you do.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  8. #8
    Registered User
    Join Date
    Dec 2007
    Posts
    5
    Oh I see...

    Just read this up on wiki :


    Tools, headers and libraries
    The Windows SDK contains the following:

    For Win32 development:
    1,700 Headers
    281 Libraries
    110 Tools


    Just to confirm :
    Does the Windows SDK reference (or the libraries provided by Microsoft Visual Studio 2005) located here ? : http://msdn2.microsoft.com/en-us/lib...fz(VS.80).aspx
    Last edited by transcend3nt; 12-15-2007 at 07:56 AM.

  9. #9
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Sure, it looks like it.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  10. #10
    Registered User
    Join Date
    Dec 2007
    Posts
    5
    Hmm.. It is really difficult to navigate through the library reference, and very difficult to find functions to use. I had to go through so many links.

    Are there any alternative references to it?

    I remembered that my tutor said they do not use Microsoft Visual Studio to develop their C++ programs. Are there any free tools/libraries that you guys use to develop?

  11. #11
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Visual Studio (express edition) is free.
    For C++ I've never used anything other than Visual Studio (except when compiling on UNIX), but I know some of the people on this board keep talking about Dev C++.
    Either way, any Windows compiler will still have to use the Windows API, so the MSDN is your best source for Windows API info.

  12. #12
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    I believe if you download Microsoft's "Platform SDK", it installs a complete copy of the documentation on your computer. This lets you look up functions etc. in an index, instead of browsing by table of contents. The documentation may also be available as a separate download.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  13. #13
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    FYI, there's nothing wrong with Visual Studio. In fact, it's a very good compiler and IDE in one. If anything, I do recommend it over other compilers especially due to that it's much easier than other (you don't have to manually specify command lines, it shows the exact compiler output as it compiles it, it has an error list to browse through errors, it has a very powerful debugger, etc).
    Granted, it is a professional tool, but Microsoft made the Express version free was very nice of them.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  14. #14
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by Elysia View Post
    FYI, there's nothing wrong with Visual Studio. In fact, it's a very good compiler and IDE in one. If anything, I do recommend it over other compilers especially due to that it's much easier than other (you don't have to manually specify command lines, it shows the exact compiler output as it compiles it, it has an error list to browse through errors, it has a very powerful debugger, etc).
    Granted, it is a professional tool, but Microsoft made the Express version free was very nice of them.
    Yeah, it must be pretty good since every company I've ever seen uses VC++ for Windows development.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What's an import library?
    By chiefmonkey in forum C++ Programming
    Replies: 1
    Last Post: 06-19-2009, 05:00 PM
  2. Property Set Library (PSL) - Announcement
    By vultur_gryphus in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 05-29-2008, 06:04 AM
  3. Makefile for a library
    By sirmoreno in forum Linux Programming
    Replies: 5
    Last Post: 06-04-2006, 04:52 AM
  4. very weird .h problem
    By royuco77 in forum C++ Programming
    Replies: 1
    Last Post: 09-11-2005, 07:55 AM
  5. better c string functions
    By samps005 in forum C Programming
    Replies: 8
    Last Post: 11-04-2003, 01:28 PM