Cygwin + MinGW + GCC 相談室 Part 8at TECH
Cygwin + MinGW + GCC 相談室 Part 8 - 暇つぶし2ch204:デフォルトの名無しさん
16/07/02 17:08:25.09 QBTa/uvw.net
過疎っているけど・・・質問させてください
Windows10Pro 64bit上にMSYS2をインストールしてMINGW64を主にシェルとして使っているのだけど
Linux上では正常に動いてMINGW64上ではSegmentation Faultになるプログラムが有るのです
どうもグローバル変数の宣言がうまく処理できていないようなんだけどコンパイルオプションとかで対処できないでしょうか?
ソースをコピペします
main.cpp-------------------------------------------
#include "class2.h"
int main( int argc, char *argv[] ) {
//Class2 object2;
return 0;
}
class1.h --------------------------------------------
#include <string>
#include <map>
class Class1 {
std::string type;
static std::map<std::string, Class1 *> map;
public:
Class1(std::string s);
~Class1();
};
class1.cpp -------------------------------------------
#include <iostream>
#include "class1.h"
Class1::Class1(std::string s) : type(s) {
std::cout << "Class1::Class1 type=" << type << std::endl;
map[type] = this;
}
std::map<std::string, Class1 *> Class1::map;
Class1::~Class1() {}


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch