On 12/6/2013 6:19 PM, Chris Stankevitz wrote:
On Fri, Dec 6, 2013 at 3:11 PM, Michael Chisholm
wrote: The headers are supposed to tell you what symbols are exported from the binary (among other things). If you change the headers without changing the binary, those won't match up, and I think you're liable to have link errors.
Andy,
Thank you for your reply. Is this a correct interpretation of what you are saying:
I use Ubuntu Linux's apt-get to install boost. I need to ask Ubuntu which flavor of GCC was used to compile boost (c++98 or c++11). Then, when I build my applications using GCC I must use the same flavor.
For example, if Ubuntu compiled boost with c++98, I cannot write a c++11 application that uses system-provided boost libraries.
Thank you again,
Chris
That is correct. Of course in any particular case, it depends on the headers in use. E.g. if enabling c++11 mode enables declaration of a move constructor in a header, but the definition doesn't exist in the library, you'll get a link error. If nothing changes when you enable c++11 mode, it probably won't matter. But in general, I wouldn't trust it to work. Consider also there are tools like pkg-config that let the compile/link settings of a dependency be discovered automatically. I think there's a similar mechanism for cmake-built libraries too. I would say that's further evidence that the compile/link settings of your dependencies are important to know, when using them in your app. Btw, there is a C++03 standard in between '98 and '11. I suspect '03 is in widest use right now. Also, I'm no linux guru, but I think you can get source packages corresponding to the binary packages, if you want to see exactly how the binaries are built. E.g. maybe with 'apt-get source ...'? Andy