std::map segmentation fault

Hi,

The following code works if I cross-compile it for one of my board using mips-linux-uclibc-g++ but crashes if I cross-compile it for another board using arm_v5t_le-g++. Any idea what's the problem?

//Webserver.h
class Webserver :public AbstractImMsgClient
{
.
.
.
private:
static std::map<std::string, std::string*> m_parameters;

};

//Webserver.cpp
std::map<std::string, std::string*> m_parameters;
static std::string NetworkingMode("0");

Webserver::Webserver()
{
.
.
.
//segmentation fault here
m_parameters["NetworkingMode"] = &NetworkingMode;
.
.
.
}

Regards,
Kwan.

I am not shure, but you can try to use the following code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
static std::string NetworkingMode("0"); // I've changed order
std::map<std::string, std::string*> m_parameters;


Webserver::Webserver()
{
.
.
.
//segmentation fault here
m_parameters.insert(std::pair<std::string, std::string*>("NetworkingMode", &NetworkingMode));
.
.
.
}
Last edited on
Topic archived. No new replies allowed.