2

Windows 7 Starter 32bit で MinGW (元々は mingw-get-inst-20120426.exe でインストール) を Eclipse for C/C++ (Indigo SR2) と組み合わせて使用​​していますが、gcc/g++ 4.7.0 にアップグレードしました:

mingw-get update
mingw-get upgrade

Eclipse が古いバージョンの参照を保持する問題を修正しました ( https://bugs.eclipse.org/bugs/show_bug.cgi?id=206372#c2 )

しかし、このような単純なプログラムを実行しようとすると、クラッシュします:

#include <iostream>
#include <cstdlib>
using namespace std;
int main (int argc, char* argv[])
{
    cout << "one = " << 1 << "\n";
    return EXIT_SUCCESS;
}

デバッグを試みたところ、問題は次のcout行にあるようです。

cout << "one = " << 1 << "\n";

それをまたぐと、Eclipse から次のエラーが通知されます。

No source available for "libstdc++-6!_ZNSo9_M_insertIlEERSoT_() at 0x6fc868a8" 

これは、その行の「ステップ オーバー」をクリックした直後の IDE のスクリーンショットです: http://i.stack.imgur.com/QexxQ.png

同じプログラムが以前は正常に機能していましたが、現在は機能しません。

新しいプロジェクトを作成しました (コンパイラ/リンカー オプションには何も触れていません) が、同じ問題が残っています。

誰か解決策を教えてください。

よろしくお願いします:)

4

2 に答える 2

4

それを見つけた !:D

Dennis が述べたように、ランタイム dll は、リンク時に使用するものとは異なるようです。

実際には、Eclipse はC:\mingw\bin\libstdc++-6.dllに対してリンクされていましたが、実行時に別のものが使用されました (つまり、 C:\Program Files\ gnuplot \bin\libstdc++-6.dll >_<)。私はずっと前にインストールしましたが、ちなみに素敵なソフトウェアです;))そのインストールディレクトリをPATHに追加しました(C:\ mingw\binもPATHにありましたが)(他の環境変数もいくつか追加しました)

私はとても怒っていたので、gnuplot lol に関連するすべてのものを削除しました (つまり、PATH からのパス、その環境変数、およびプログラムをアンインストールしました)。Cygwinも削除しました(PATHにはありませんでしたが、長い間使用していなかったので...)

その後、4.7にアップグレードしました

mingw-get update
mingw-get upgrade

私もEclipseのことをしました

そして今、すべてがうまくいっています:

one = 1

:)

C:\Windows\System32>gcc --version
gcc (GCC) 4.7.0
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


C:\Windows\System32>g++ --version
g++ (GCC) 4.7.0
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

それが役立つ場合は、依存関係ウォーカーを使用して、実行可能ファイルで使用されたランタイム dll を特定しました (依存関係ウォーカーで exe をロードし、 LIBSTDC++-6.DLL > Properties を右クリックします)。

于 2012-06-24T10:03:28.667 に答える
0

Well I know this question is well answered, but I just want to share my experience since I was confused by it for a long time (yep I haven't coded in C++ for a long time lol)

I realized that it happens because I install MinGW 4.8.1 when install JAVA eclipse and delete the old version (maybe 4.6.2 I don't remember clearly), and the dll was nowhere to find.

I didn't change anything in Path. What I had done is just reinstall the MinGW, click and click, and update all lib files it offers, and then cin & cout work. Well I really have no idea for why and wth is going on, but thx it works now.

于 2015-01-28T11:22:44.450 に答える