Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c++11 flag is not added in configure #24

Closed
Yanpas opened this issue Aug 25, 2017 · 4 comments
Closed

c++11 flag is not added in configure #24

Yanpas opened this issue Aug 25, 2017 · 4 comments

Comments

@Yanpas
Copy link

Yanpas commented Aug 25, 2017

g++ -DHAVE_CONFIG_H -I../include -I../include -I/usr/include/postgresql -g -O2 -Wno-long-long -fvisibility=hidden -fvisibility-inlines-hidden -MT binarystring.lo -MD -MP -MF .deps/binarystring.Tpo -c binarystring.cxx -fPIC -DPIC -o .libs/binarystring.o - one of the lines that was executed. autotools must explicitly add -std=c++0x

@jtv
Copy link
Owner

jtv commented Aug 29, 2017

Recent gcc versions compile C++14 by default. If you're using an older version, add the flag to the "configure" command line:

./configure CXXFLAGS='-std=c++11'

(Of course you can also say c++14 to get a more modern dialect.)

I could add this option in the configure script, but that opens the door to questions like: What if your compiler uses a different option for this? Which C++ versions does your compiler version support? What if you want a different C++ version? What if the compiler defaults to a newer version?

So the best solution, I think, is to set this option in your "configure" until your systems are upgraded to more recent compiler versions. I was tempted to make C++14 the minimum, but I kept it to C++11 for now to minimise these problems...

@Yanpas
Copy link
Author

Yanpas commented Aug 29, 2017

Thanks, didn't know. I barely know autotools but CMake has CXX_STANDARD option. If there is something similar you may add this to configure script.

@Yanpas Yanpas closed this as completed Aug 29, 2017
@jtv
Copy link
Owner

jtv commented Aug 29, 2017

I don't know of anything like that, but now that you bring it up, I did notice something strange: on an older gcc, if I passed -std=c++17 or -std=c++20, the command line would still say -std=c++14 — I guess maybe that was the newest standard which that compiler supported.

So probably there is some logic for picking the C++ standard in there. But I'm sort of afraid to mess with it! :)

@jtv
Copy link
Owner

jtv commented Sep 9, 2017

I just got "configure" to add the C++11 option. This does mean that autogen.sh now requires the autoconf-archive package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants