[Solved] Accessing struct member through unique_ptr gives segmentation fault [closed]

First, std::unique_ptr is a class not a struct, so get rid of the struct prefix on the pdfInfo variable declaration. You were probably thinking of this instead: std::unique_ptr<struct Canvas::LoadedPDFInfo> pdfInfo; But even when declaring variables (or type-casting) using actual struct types, you still do not need the struct prefix. C needs that, C++ does not. … Read more