简体   繁体   中英

c++ boost library cannot open file

I tried to work with the boost library to read/write configuration files but I just don't get it.

I even can't run the example code from boost.org (5 Minute Tutorial) http://www.boost.org/doc/libs/1_49_0/libs/property_tree/examples/debug_settings.cpp

I've downloaded the boost_1_49_0.zip package and unzipped it to my c++ program folder. The code compiles (TheIDE - U++) but it always says "Error: debug_settings.xml: cannot open file" which basically means that the program works, but runs into the exception.

I didn't change the code, I just copy and pasted it to get a working example which I could try to understand then. But I don't even get this one to work. (Since it's exactly the same as in the link, I don't paste the code here... unless you think it's better.)

Please help me... or point to a different way to store variables in a file with some kind of structure (I wan't to learn a way that works for windows and linux, because some of my apps are cross-platform.)

Thanks.

EDIT: debug_settings.xml is in the same folder as the .cpp file

EDIT2: Working now, the debug_settings.xml is now in the folder where the executable is stored. (in my case, U++/TheIDE it's C:\\upp\\out\\MyApps\\MINGW.Debug.Debug_Full.Sse2 for debugging)

配置文件在运行时需要位于可执行文件的工作目录中。

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM