This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Compiler options

Tags: None
(comma "," separated)
ghost9
Karma
0

Compiler options

Tue Jun 25, 2013 7:16 am
Hey there and 'hello' from a new user! :-)

With some minor experience in Java, C, and Python, I am currently trying to learn C++. I am using KDevelop 4.4.1 under openSUSE 12.3 and KDE 4.10. After some research concerning building and running my examples with KDevelop the IDE works pretty fine for me, except for one thing: my C++ textbook uses several C++11 techniques, and the building process of KDevelop won't accept them.

I already did some research, but it seems to me there's no way to simply add compiler settings like '-std=c++11' in any preferences dialogue. Some answers regarding compiler options that I found on the web lead to manually editing the makefile created by KDevelop. Is this the only possibility to compile my examples with C++11 support? And if so, since I don't have any experience with makefiles and would like to concentrate on C++ itself for the time being, what line do I have to add to which file?

Any help is appreciated. :-)

All the best,
Dennis
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Compiler options

Tue Jun 25, 2013 10:36 am
Which build system does the KDevelop project you have created use?


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
ghost9
Karma
0

Re: Compiler options

Tue Jun 25, 2013 11:27 am
bcooksley wrote:Which build system does the KDevelop project you have created use?


I create the projects as simple CMake projects, which is the only option KDevelop gives me besides Qt project.
User avatar
scummos
Global Moderator
Posts
1175
Karma
7
OS

Re: Compiler options

Tue Jun 25, 2013 2:46 pm
There is no such thing as a "KDevelop build process" -- KDevelop just calls CMake. To enable c++11 in cmake, add e.g. this to your CMakeLists.txt:
Code: Select all
add_definitions(-std=c++11)


Greetings


I'm working on the KDevelop IDE.
ghost9
Karma
0

Re: Compiler options

Mon Jul 01, 2013 5:06 pm
@scummos - that did the trick, thank you so much.

This should definitely be an option in one of the dialogs for creating a new project!
User avatar
scummos
Global Moderator
Posts
1175
Karma
7
OS

Re: Compiler options

Mon Jul 01, 2013 9:53 pm
I guess that could be implemented as a "C++11" variant for one (or more) of the project templates.


I'm working on the KDevelop IDE.
LateBloomer
Registered Member
Posts
1
Karma
0
Years go by, problems persist.
I've had a problem with "‘to_string’ was not declared in this scope" error and solved it with scummos solution (thanks scummos!)
It seems that error was common during y2013 according to SO (http://stackoverflow.com/questions/1556 ... d-in-scope , http://stackoverflow.com/questions/1297 ... -says-so-g), but it's y2015 now.
The name of this topic is misleading, it's about c++11 support, and I wanted to enter the name of to_string func. so that anyone with same problem could find this using search.
Again, thanks scummos!


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], lockheed, Sogou [Bot], Yahoo [Bot]