Hello,

I am writing a little program and have run into a strange error doing something I must have done thousands of times. I am writing a static map<unsigned int, string> in a header file and find I can't assign a value to the string.

Code:
// write_file_comments.h

// include guard
#ifndef WRITE_FILE_COMMENTS_CPP_H
#define WRITE_FILE_COMMENTS_CPP_H

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

   // map to hold comment lines
   std::map<unsigned int, std::string> file_comments;

   // string to hold the map element value
   std::string element_value;

   // assign element
   element_value = "LL and MM";
   // also doesn't work
   // element_value.assign("LL and MM");

   // add to map
   file_comments['0'] = element_value;

// end include guard
#endif
I am getting the following compiler errors at the "element_value =" line
Code:
 error: expected constructor, destructor, or type conversion before '=' token
 error: expected `,' or `;' before '=' token
I get the same error if I use assign() instead of the = operator.

It is hard to imagine what I am doing with something this simple. This is c++98, but should work in any c++ that has ever been released. Am I missing some include or other? I'm sure it's something simple and dumb but I can't see it. I have code examples of other maps I have set up just like this and I have never seen this error before.

Help would be appreciated as always,

LMHmedchem