I am porting a project from Windows to Linux/Ubuntu, which involves using open software called "PST SDK" ( http://pstsdk.codeplex.com ) written in c++. This has not been updated since 2010 but it works fine in Windows and supposedly works/did work in Linux. I set up a demo program with nothing more than including the header files (the library is all headers, nothing to link). I had a lot of errors but got them fixed by using g++ instead of gcc, and fiddling with the location of the library files and required boost files.
However once I tried making some calls, I ran into problems. I got a few things working, but the following code:
std::vector<pstsdk::folder> folderlist;
folderlist.push_back(folder);
causes this compile error:
error: 'pstsdk::property_bag& pstsdk::property_bag::operator=(const pstsdk::property_bag&)' is private
(There is a lot of other veribiage about what was instantiated from what file). Here is the compile command:
g++ -c -I/usr/local/include -Iboost_1_46_1 -Ipstsdk -I/usr/local/include/mysql ostdemo.cpp
It is specifically the push_back call causing the errors - take that out and they go away. Of course that is critical to the working of my program. Any idea what this could be? I assume it has something to do with my compiler version or switches, but I can't figure it out. I am not much of a c++ programmer so any help would be appreciated.
Your vector::push_back()
requires that the type is copy-assignable
. Obviously, your pstsdk::folder
is not copy-assignable due to the assignment operator being private
.
What are the requirements for a type to be placed in a vector? It depends on whether you're using pre-C++11 or C++11, plus what operations you plan to do on these types. See here:
http://en.cppreference.com/w/cpp/container/vector
Pay attention to CopyAssignable
, CopyConstructible
, MoveAssignable
and MoveConstructible
So the case of it working with Windows as opposed to Linux:
Remember that "Windows" and "Linux" are not C++ compilers. You need to expand on this and tell us what version of the g++ compiler you're using on each OS.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.