2016-04-14 9 views
0

C++アプリケーションでhash_mapを使用しています。バージョン4.1.2でアプリケーションをビルドすると成功しました。私はバージョンでアプリケーションを構築しようとすると、それは私が/usr/include/c++/4.4.6/backward/backward_warning.hを見て、unordered_maphash_mapを変更の提案に基づいてC++ 4.4.6にhash_mapを含めるには?

/include/c++/4.4.6/backward/backward_warning.h:28:2: error: #warning This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated.

としてエラーを投げている4.4.6。

は今、私は/usr/include/c++/4.4.6/c++0x_warning.hにのみエラーメッセージを見ることができ、

/include/c++/4.4.6/c++0x_warning.h:31:2: error: #error This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options.

を、次のエラーを取得しています。

私はC++をかなり新しくしています。誰かが私にこれを手伝ってもらえますか?

+1

"hash_map"の変更をunordered_mapに元に戻してから、コンパイル構造の最後に "-Wno-deprecated"(引用符は不要)を追加してください。 4.4.6で廃止予定のパッケージがあるようです –

+1

-std = C++ 0xまたは-std = gnu ++ 0xコンパイラオプションでC++ 0xサポートを有効にできますか? (C++ 0xは2011年に標準化されて以来C++ 11と呼ばれています)。または、-Wno-deprecatedを指定して最初の警告を無効にすることもできます。または、5年より新しいコンパイラ・バージョンを使用することもできます。 – immibis

+1

C++ 11を有効にする必要がある 'std :: unordered_map'を使う代わりに' std :: tr1 :: unordered_map'( '#include ')を使うことができます – Praetorian

答えて

1

GCC(g++)を使用していると仮定すると、コンパイラにC++ 11を使用させるメッセージが表示されるので、-std=c++0xをコマンドラインに追加してみてください。

+0

ありがとうございます。 Makefileで '-std = C++ 0x'を使うにはどうすればいいですか? – Dany

+0

私は 'CXXFLAGS + = -std = C++ 0x'を試み、' CCFLAGS + = -Werror -Wno-deprecated'から '-Wno-deprecated'を削除しました。私は 'CCFLAGS + = -Werror CXXFLAGS + = -std = C++ 0x'のようなものを使用していましたが、動作しませんでした。 – Dany

関連する問題