error: ‘serialize’ was not declared in this scope

Issue #348 resolved
Lari Karam created an issue

Hi there,

I was trying the Matrix serialization in the wiki section and came with this error:

/usr/local/include/blaze/util/serialization/Archive.h: In instantiation of blaze::DisableIf_t<IsNumeric_v<T>, blaze::Archive<Stream>&> blaze::Archive<Stream>::operator<<(const T&) [with T = blaze::DynamicMatrix<double, true>; Stream = std::basic_ofstream<char>; blaze::DisableIf_t<IsNumeric_v<T>, blaze::Archive<Stream>&> = blaze::Archive<std::basic_ofstream<char> >&]:
testBlaze.cpp:46:20:   required from here
/usr/local/include/blaze/util/serialization/Archive.h:350:13: error: serialize was not declared in this scope
  350 |    serialize( *this, value );
      |    ~~~~~~~~~^~~~~~~~~~~~~~~~ 

I’m still in exploration mode with blaze not sure if I missed something or this is a bug. Here is my code:

#include <iostream>
#include <fstream>
#include <ostream>

#include <blaze/math/DynamicMatrix.h>
#include <blaze/util/Random.h>
#include <blaze/Util.h>

int main(){
    blaze::DynamicMatrix<double, blaze::columnMajor> mb (10, 10);
    blaze::randomize(mb);

    {
        blaze::Archive<std::ofstream> archive("matrix.blaze");
        archive << mb;
    }
    return 0;
}

Any pointer or guidance would be much appreciated.

best

Lari

Comments (6)

  1. Klaus Iglberger

    Hi Lari!

    Please change your includes as follows and the compilation error will disappear:

    #include <blaze/math/DynamicMatrix.h>
    #include <blaze/math/Serialization.h>   // <---- Needs to be added explicitly
    //#include <blaze/util/Random.h>        // <---- Part of <blaze/Util.h>
    #include <blaze/Util.h>
    

    We will update the information in the tutorial and wiki accordingly. Thanks for pointing this out,

    Best regards,

    Klaus!

  2. Klaus Iglberger

    Commit 3af8fc1 resolves all possible compilation issues with serialization not being available when including vector and/or matrix types. The fix is immediately available via cloning the Blaze repository and will be officially released in Blaze 3.8.

  3. Log in to comment