Hello, Please consider the following: application A depends on boost compiled libraries application A depends on library B library B depends on boost compiled libraries Q1: Will I have a problem if: application A is compiled with gcc c++11 library B is compiled with gcc c++98 boost compiled with gcc c++98 Q2: Will I have a problem if: application A is compiled with gcc c++11 library B is compiled with gcc c++11 boost compiled with gcc c++98 My concern is that boost produces different code in its headers based on whether or not the compiler supports c++11. Thank you, Chris
On 12/6/2013 5:53 PM, Chris Stankevitz wrote:
Hello,
Please consider the following:
application A depends on boost compiled libraries application A depends on library B library B depends on boost compiled libraries
Q1: Will I have a problem if: application A is compiled with gcc c++11 library B is compiled with gcc c++98 boost compiled with gcc c++98
Q2: Will I have a problem if: application A is compiled with gcc c++11 library B is compiled with gcc c++11 boost compiled with gcc c++98
My concern is that boost produces different code in its headers based on whether or not the compiler supports c++11.
Thank you,
Chris
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. imho, Andy
On Fri, Dec 6, 2013 at 3:11 PM, Michael Chisholm
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
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
Gesendet: Freitag, 06. Dezember 2013 um 23:53 Uhr Von: "Chris Stankevitz"
An: "boost-users@lists.boost.org" Betreff: [Boost-users] mixing c++98 with c++11 Hello,
Please consider the following:
application A depends on boost compiled libraries application A depends on library B library B depends on boost compiled libraries
Q1: Will I have a problem if: application A is compiled with gcc c++11 library B is compiled with gcc c++98 boost compiled with gcc c++98
Q2: Will I have a problem if: application A is compiled with gcc c++11 library B is compiled with gcc c++11 boost compiled with gcc c++98
My concern is that boost produces different code in its headers based on whether or not the compiler supports c++11.
Thank you,
Chris _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hi, not sure if I can help you here. I once had the problem, that *my* library B depended on Boost 1.3x, and well, no way to change that. So, I had to cope with 2 different versions of boost. Still, same compiler and ABI. GCC might is able to let you interface between the ABIs, but maybe you'll need a library C that acts as a proxy to C++98 from '11(14,1y...). To your concerns of boost being different for '98 and everything after: yes. I wouldn't let the versions mix. So you'll need to contain the versions, in this case the lib b to a set of cpp files and private headers, not shared with A. Any other case, you're basicly asking for trouble (but, might still work). kind regards, Jens
participants (3)
-
Chris Stankevitz
-
Jens Weller
-
Michael Chisholm