C++: Getting the “error C2065: 'pst' : undeclared identifier” while using pstsdk?

假装没事ソ 提交于 2020-01-07 04:08:12

问题


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:


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

 pstsdk::pst myfile(fileNameTextBox->Text);


来源:https://stackoverflow.com/questions/4594640/c-getting-the-error-c2065-pst-undeclared-identifier-while-using-pstsdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!