C++: Getting the “error C2065: 'pst' : und

2019-08-27 01:39发布

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?

1条回答
你好瞎i
2楼-- · 2019-08-27 01:52

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

 pstsdk::pst myfile(fileNameTextBox->Text);
查看更多
登录 后发表回答