How to Inlcude STL::Map

Discussion in 'C Programming' started by viveque.kumar@gmail.com, Dec 22, 2005.

  1. Guest

    How do I go about including an STL::Map in a C file?

    Doing:
    #include <map>
    using namespace std;

    gives me a lot of errors in VC7... Ofcourse it is because <map> is a
    C++ header file...
    Is there anything else I can do to use this STL map here...?

    - Vivek
     
    , Dec 22, 2005
    #1
    1. Advertising

  2. Richard Bos Guest

    wrote:

    > How do I go about including an STL::Map in a C file?


    You don't.

    If you want to use C code in a C++ program, C++ has features for doing
    so. C has no features for going the other way.

    Richard
     
    Richard Bos, Dec 22, 2005
    #2
    1. Advertising

  3. Targeur fou Guest

    wrote:
    > How do I go about including an STL::Map in a C file?
    >
    > Doing:
    > #include <map>
    > using namespace std;
    >
    > gives me a lot of errors in VC7... Ofcourse it is because <map> is a
    > C++ header file...


    You have your answer. Why would you include a C++ header in a C file?
    C and C++ are two different languages.

    > Is there anything else I can do to use this STL map here...?


    Yes, implementing in C your own associative container.

    A+
    Regis
     
    Targeur fou, Dec 22, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark F
    Replies:
    5
    Views:
    957
    Mark F
    Dec 7, 2004
  2. Mopelee
    Replies:
    7
    Views:
    380
    Jaspreet
    Apr 5, 2006
  3. Replies:
    2
    Views:
    556
    klaus hoffmann
    Feb 22, 2006
  4. Adrienne

    Inlcude Null Values in Result Set

    Adrienne, Aug 7, 2005, in forum: ASP General
    Replies:
    0
    Views:
    124
    Adrienne
    Aug 7, 2005
  5. Luca Risolia

    STL map to STL vector

    Luca Risolia, Jan 13, 2014, in forum: C++
    Replies:
    32
    Views:
    373
    Seungbeom Kim
    Jan 18, 2014
Loading...

Share This Page