sanshar / Block

Block implements the density matrix renormalization group (DMRG) algorithm for quantum chemistry.
GNU General Public License v3.0
31 stars 33 forks source link

Error when compiling with g++ and mpicxx #14

Closed ghost closed 9 years ago

ghost commented 9 years ago

modules/npdm/npdm_expectations.C:855:18: error: ‘class std::mapstd::vector<int, SpinAdapted::Wavefunction>’ has no member named ‘emplace’ modules/npdm/npdm_expectations.C: In member function ‘void SpinAdapted::Npdm::Npdm_expectations::store(SpinAdapted::Npdm::NpdmSpinOps_base&)’: modules/npdm/npdm_expectations.C:899:14: error: ‘class std::mapstd::vector<int, SpinAdapted::Wavefunction>’ has no member named ‘emplace’ make: *\ [modules/npdm/npdm_expectations.o] Error 1

gkc1000 commented 9 years ago

Hi, are you using a C++11 compliant compiler? emplace is part of the C++11 standard library.

On Fri, May 29, 2015 at 1:31 PM, Hassenky notifications@github.com wrote:

modules/npdm/npdm_expectations.C:855:18: error: ‘class std::mapstd::vector<int, SpinAdapted::Wavefunction>’ has no member named ‘emplace’ modules/npdm/npdm_expectations.C: In member function ‘void SpinAdapted::Npdm::Npdm_expectations::store(SpinAdapted::Npdm::NpdmSpinOps_base&)’: modules/npdm/npdm_expectations.C:899:14: error: ‘class std::mapstd::vector<int, SpinAdapted::Wavefunction>’ has no member named ‘emplace’ make: *\ [modules/npdm/npdm_expectations.o] Error 1

— Reply to this email directly or view it on GitHub https://github.com/sanshar/Block/issues/14.

ghost commented 9 years ago

I am using gcc 4.7 so I guess It does not support C++11. But, when I use intel compiler (2015), the same error happened. It is so strange.

"modules/npdm/npdm_expectations.C(855): error: class "std::map<std::vector<MPI_Datatype={int}, std::allocator>, SpinAdapted::Wavefunction, std::less<std::vector<MPI_Datatype={int}, std::allocator>>, std::allocator<std::pair<const std::vector<MPI_Datatype={int}, std::allocator>, SpinAdapted::Wavefunction>>>" has no member "emplace" waves_.emplace(spin,opw2); ^

modules/npdm/npdm_expectations.C(899): error: class "std::map<std::vector<MPI_Datatype={int}, std::allocator>, SpinAdapted::Wavefunction, std::less<std::vector<MPI_Datatype={int}, std::allocator>>, std::allocator<std::pair<const std::vector<MPI_Datatype={int}, std::allocator>, SpinAdapted::Wavefunction>>>" has no member "emplace" waves_.emplace(spin,opw2); ^

compilation aborted for modules/npdm/npdm_expectations.C (code 2)

gkc1000 commented 9 years ago

Did you use -std=c++11

On Fri, May 29, 2015 at 4:15 PM, Hassenky notifications@github.com wrote:

I am using gcc 4.7 so I guess It does not support C++11. But, when I use intel compiler (2015), the same error happened. It is so strange.

"modules/npdm/npdmexpectations.C(855): error: class "std::map>, SpinAdapted::Wavefunction, std::less>>, std::allocator>, SpinAdapted::Wavefunction>>>" has no member "emplace" waves.emplace(spin,opw2); ^

modules/npdm/npdmexpectations.C(899): error: class "std::map>, SpinAdapted::Wavefunction, std::less>>, std::allocator>, SpinAdapted::Wavefunction>>>" has no member "emplace" waves.emplace(spin,opw2); ^

compilation aborted for modules/npdm/npdm_expectations.C (code 2)

— Reply to this email directly or view it on GitHub https://github.com/sanshar/Block/issues/14#issuecomment-106924077.

gkc1000 commented 9 years ago

I noticed on the compiler webpage

https://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler

  1. 1: * Full C++11 support requires gcc 4.8 environment or newer on Linux

On Fri, May 29, 2015 at 4:17 PM, Garnet Chan gkc1000@gmail.com wrote:

Did you use -std=c++11

On Fri, May 29, 2015 at 4:15 PM, Hassenky notifications@github.com wrote:

I am using gcc 4.7 so I guess It does not support C++11. But, when I use intel compiler (2015), the same error happened. It is so strange.

"modules/npdm/npdmexpectations.C(855): error: class "std::map>, SpinAdapted::Wavefunction, std::less>>, std::allocator>, SpinAdapted::Wavefunction>>>" has no member "emplace" waves.emplace(spin,opw2); ^

modules/npdm/npdmexpectations.C(899): error: class "std::map>, SpinAdapted::Wavefunction, std::less>>, std::allocator>, SpinAdapted::Wavefunction>>>" has no member "emplace" waves.emplace(spin,opw2); ^

compilation aborted for modules/npdm/npdm_expectations.C (code 2)

— Reply to this email directly or view it on GitHub https://github.com/sanshar/Block/issues/14#issuecomment-106924077.

junyang4711 commented 9 years ago

To be on safe side, please try g++ version higher than 4.8.2 with -std=c++11.

Jun

On Fri, May 29, 2015 at 4:19 PM, gkc1000 notifications@github.com wrote:

I noticed on the compiler webpage

https://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler

  1. 1: * Full C++11 support requires gcc 4.8 environment or newer on Linux

On Fri, May 29, 2015 at 4:17 PM, Garnet Chan gkc1000@gmail.com wrote:

Did you use -std=c++11

On Fri, May 29, 2015 at 4:15 PM, Hassenky notifications@github.com wrote:

I am using gcc 4.7 so I guess It does not support C++11. But, when I use intel compiler (2015), the same error happened. It is so strange.

"modules/npdm/npdmexpectations.C(855): error: class "std::map>, SpinAdapted::Wavefunction, std::less>>, std::allocator>, SpinAdapted::Wavefunction>>>" has no member "emplace" waves.emplace(spin,opw2); ^

modules/npdm/npdmexpectations.C(899): error: class "std::map>, SpinAdapted::Wavefunction, std::less>>, std::allocator>, SpinAdapted::Wavefunction>>>" has no member "emplace" waves.emplace(spin,opw2); ^

compilation aborted for modules/npdm/npdm_expectations.C (code 2)

— Reply to this email directly or view it on GitHub https://github.com/sanshar/Block/issues/14#issuecomment-106924077.

— Reply to this email directly or view it on GitHub https://github.com/sanshar/Block/issues/14#issuecomment-106924906.

ghost commented 9 years ago

With gcc 4.7, I did use -std=c++11, but could not overcome "emplace" error. I'll install new version of gcc and try again. Thanks so much.

junyang4711 commented 9 years ago

gcc 4.7 supports some but many features of c++11 for which you will continually see more errors of compiling. Newer version shall solve the problem.

Jun

On Fri, May 29, 2015 at 4:28 PM, Hassenky notifications@github.com wrote:

With gcc 4.7, I did use -std=c++11, but could nod overcome "emplace" error. I'll install new version of gcc and try again. Thanks so much.

— Reply to this email directly or view it on GitHub https://github.com/sanshar/Block/issues/14#issuecomment-106926923.