Unable to build for Mac OSX 10.6
|Status:||Closed||Start date:||09 Jan 2016|
|Assignee:||Robin Mills||% Done:|
|Category:||build||Estimated time:||2.00 hours|
I can not build the library from latest revision for the Mac OSX 10.6.
I'm using a Mac with OSX 10.10 64bit, so I put the line "-stdlib=libstdc++ -mmacosx-version-min=10.6" into CPPFLAGS, LDFLAGS, etc.
actions.cpp:1973:26: error: no viable conversion from 'const std::string' (aka 'const basic_string<char>') to 'const char *' fb.open (target,std::ios::out); ^~~~~~ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/fstream:286:24: note: passing argument to parameter '__s' here open(const char* __s, ios_base::openmode __mode); ^
#1 Updated by Robin Mills almost 3 years ago
- Category set to build
- Status changed from New to Assigned
- Assignee set to Robin Mills
- Target version set to 0.26
- % Done changed from 0 to 50
- Estimated time set to 2.00
Max. Thanks for letting me know about this. I was very surprised by this because I obtained that code from a very credible source: http://www.cplusplus.com/reference/ostream/ostream/ostream/
The quick fix is to change:
fb.open (target.c_str(),std::ios::out);However, I'm uneasy about that. c_str() is a legacy thing and should be avoided. I'll have a proper look at this on Sunday.
#2 Updated by Robin Mills almost 3 years ago
- Status changed from Assigned to Resolved
- % Done changed from 50 to 100
Fix submitted: r4177
Good News, this code was broken on the buildsever. I submitted the code and went to the movies. It had only been on the trunk for an hour when you raised this matter. So, I would have discovered this when I got home from the movies!
I've replaced the filebuf code in src/actions.cpp:
// http://www.cplusplus.com/reference/ostream/ostream/ostream/ std::filebuf fb; fb.open (target.c_str(),std::ios::out); std::ostream os(&fb); sourceImage->printStructure(os,Exiv2::kpsXMP); fb.close();with:
// http://www.cplusplus.com/doc/tutorial/files/ std::ofstream os; os.open(target.c_str()); sourceImage->printStructure(os,Exiv2::kpsXMP); os.close();Which is shorter and more obvious. I need the c_str() on Tiger and Cygwin. It may be possible to detect the version of STL and only include the c_str() when essential, however I'll investigate that possibility if a bug is reported which implicates this code. For the moment it builds and passes the test suite on our supported platforms. http://exiv2.dyndns.org:8080/job/Exiv2-trunk/2348/