I have a question about the map-question JoBe asked at the start of this post. I'm also trying to build a program using <map>, but when i compile i get error that point to code inside the MAP-file.

I saw your post here, and i tried your small program, but even then i get 2 errors inside the MAP-file, and also those warnings you asked about.
I don't know why i get those errors.
JoBe's code was:

#include <iostream>
#include <string>
#include <map>

using namespace std;

int main()
{
    typedef map<string, int, less<string> > maptype;
    maptype M;

    M["Jan"]   = 1234;
    M["Piet"]  = 9999;
    M["Piet"]  = 3456;
    M["Klaas"] = 5678;

    for(maptype::iterator i = M.begin(); i != M.end(); ++i)
        cout<< (*i).first <<" "<< (*i).second <<endl;

    cout<<"Press any key to continue!\n";
    cin.get();

    return 0;
}

When i make a new project (win32 console app) and i compile it, i get these 2 errors:

c:\program files\microsoft visual studio\vc98\include\map(16) : error C2143: syntax error : missing ';' before 'namespace'
c:\program files\microsoft visual studio\vc98\include\map(16) : error C2501: 'B' : missing storage-class or type specifiers

Anyone any idea why this happens?

TIA

The code is fine and should work. Try rebuilding solution.

The code is fine and should work. Try rebuilding solution.

i rebuiled it a couple of times, but i still got the errors.
i believe you guys when you say it works, but i don't get why i get these errors. Maybe a fault in my Options or something? i don't know :sad:

Maybe there's a problem with your compiler/IDE installation or with the header files.

Also, make sure your code is being compiled as C++ and not C

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.