C++: Getting the "error C2065: 'pst' : undeclared identifier" while using pstsdk?
Asked Answered
P

1

0

Following the suggestion of working with the pstsdk in this question:
Processing Microsoft Office Outlook 2003/2007 email messages…

And following the instructions here:
PST File Format SDK - PST Layer Overview - Getting Started

And also according to this video:
In PST SDK Presentation, Terry Mahaffey, discusses the PST SDK file format SDK.
(Forward it to 28:32)

They all agree that I only have to include the PST header file after having properly added the include paths for both Boost and pstsdk, and to write the following code to start working with my pst file:

#include "pst.h"

pst myfile(L"myfile.pst");

Now, I'm using a mix of managed and unmanaged C++, hence I'm trying to put this code in my function like so:

private: 
    System::Void readPstFileButton_Click(System::Object^  sender, System::EventArgs^  e) {
        pst myfile(fileNameTextBox->Text);
    }

And everytime I compile, I get the c2065 error code that says the pst is undeclared.

Any clue anyone?

EDIT #1

After I have done as suggested by Hans Passant (which works), my code now looks like this:

private:
    System::Void readPstFileButton_Click(System::Object^  sender, System::EventArgs^  e) {
         pstsdk::pst myfile(marshal_as<std::wstring>(fileNameTextBox->Text));
    }

And I now get the following errors:

error C3859: virtual memory range for PCH exceeded; please recompile with a command line option of '-Zm111' or greater

error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit

I definitely didn't expect these to occur. How to solve them?

Popelka answered 4/1, 2011 at 14:25 Comment(0)
G
2

It is declared in a namespace, as it should. Fix:

 pstsdk::pst myfile(fileNameTextBox->Text);
Gill answered 4/1, 2011 at 14:44 Comment(4)
Yes, and I figure out to have a type mismatch or something like so: error C2664: 'pstsdk::pst::pst(const std::wstring &)' : cannot convert parameter 1 from 'System::String ^' to 'const std::wstring &'. I understand that is a fact of mixing managed and unmanaged C++, but I don't seem to be able to type cast in anyway.Popelka
Well, I warned you about this in your previous post, C++/CLI is not C++. You need to convert the String^ to a wstring. msdn.microsoft.com/nl-be/library/bb384865%28en-us%29.aspxGill
Hehehe... Yes, you did! And I'm glad you did. Now, I wish to become as fluent in C++/CLI and C++ than in C#, or close to, at least. That is why I give myself this hard "homework", to learn the hard way. Working with a real problem, I will learn more effectively, in my opinion. Thanks for the link! =)Popelka
You have to start a new question.Gill

© 2022 - 2024 — McMap. All rights reserved.