« first day (493 days earlier)      last day (4454 days later) » 

10:00 AM
I think it's interesting that the need is not there in Python, because Python has mathematical floor-like rounding of integer division
So in Python one can just negate and the rounding goes the other way.
But perhaps not many who are aware of that.
 
@hochl Classes with assignment operators in inheritance hierarchies are rarely a good idea.
 
sbi
@hochl Derived classes might depend on base classes, so those should be done when derived classes do their work. However...
I'd question the need to write assignment operators in class hierarchies. Manual resource management (and that's what makes you need to implement an assignment operator) should be limited to small resource wrappers, which usually don't need inheritance.
@FredOverflow Damn. I was polishing a nice, complete answer for a minute or two, and then you come and beat me to it by posting a simple sentence mere ten seconds before I posted mine. Life is unfair. :(
 
Hmmm... don't think I can finger into the programm too much at this point.
On the light side it's a resource wrapper with a common base class.
The base seems to lack operator = since it has no members.
 
sbi
@hochl Ah, that's why I sneaked a "usually" into my sentence. :)
@hochl You mean it seems to lack an explicit implementation, don't you?
 
@sbi: Exactly, it relies on implicit everywhere except the destructor.
which is virtual
At least valgrind couldn't find memory leaks, that makes me optimistic :P
 
sbi
10:10 AM
@hochl Yeah, as per the Rule of Three™, making it virtual is the only reason to explicitly implementing a dtor when you're not also implementing cctor and asop.
 
Hello. Another trivia question. If I want to create a sequence of values {1, ..., N} for some given N, but want to do this in a container agnostic way, i.e. would work not only with vector but also any similar sequence type container, what are my options?
 
pass two iterators
std::vector<int> foo(100);
your_function(foo.begin(), foo.end());
It cannot work for std::set by the way, because set elements are immutable.
Oh wait, you could probably pass a back_inserter.
Maybe your function should better take an iterator and a number of elements instead of two iterators then.
 
back_inserter somehow feels dirty.
 
But it achieves a goal.
 
Hmmm. True ...
 
10:14 AM
@FredOverflow : Some insert operation still needs to be specified. like push_back.
 
Erm, no? The vector already has 100 elements.
 
sbi
@FredOverflow Yep, that's what I'd think, too.
 
@FaheemMitha Output iterators returned by e.g. std::back_inserter provide such a container-agnostic interface.
 
sbi
    template<typename Int, typename OutIt>
    OutIt generate_n(Int n, OutIt out);

    std::vector<int> foo;
    generate_n(10, std::back_inserter(foo));
 
@FredOverflow : If you are talking to me, I don't follow.
@LucDanton I was considering using insert.
 
10:19 AM
Don't.
 
@LucDanton : Why?
 
Because you don't really care whether the items you pass are inserted at the start, at the end, or after the 42nd element.
 
Oh wait, is there even something like a back_inserter for std::set?
 
There's a generalized inserter but I forgot how it goes.
Something like std::inserter(c, c.begin())
Which will do calls to c.insert(it, element) where it is e.g. c.begin() here. I don't know if it is updated between calls, but I don't think all the containers are consistent enough in their interfaces to allow this.
 
But I cannot insert into a std::set at a specific position.
 
10:25 AM
@FredOverflow the second parameter is just a hint anyway, iirc
as in, std::set will ignore it
for sorted containers, it just specifies where to start searching from
or something like that
 
@LucDanton : Well, I do want them in order.
Sorry for the slow responses - my connection is being erratic again.
 
@FaheemMitha Right, so you only need the OuputIterator concept.
 
@sbi Probably not a good idea to reuse names from the standard library.
 
@LucDanton Is that more general?
 
template<class OutputIterator, class Size, class Generator>
OutputIterator generate_n(OutputIterator first, Size n, Generator gen);
 
sbi
10:30 AM
@FredOverflow Oops. That's why the name seemed so familiar. :-/
 
@FaheemMitha It's enough, and it's idiomatic.
 
@LucDanton ; So, something like @sbi posted?
Freaking link went down again.
 
@FaheemMitha Yes.
 
Is there something wrong I didn't see? stackoverflow.com/q/9373798/589206 the dude just posted this doesn't work and vanished.
plop
 
10:46 AM
@FaheemMitha Instead of writing a function that generates the numbers, you could also write a class that represents a range of numbers and which can be iterated over. Then you can use that to directly iterate over it or initialize containers from it etc.
 
Ok, another trivia question. What is the syntax for templating on a class T<int>?
 
template<typename Integer> class Foo
int is a type just like any other
 
@FredOverflow : Thanks.
@FredOverflow : I want the class to be a template.
 
And that's exactly what template<typename Integer> class Foo achieves.
 
@FredOverflow Oh, ok.
 
10:50 AM
Oh wait, maybe I misunderstood, is the T in T<int> supposed to be a template parameter?
 
@FredOverflow : yes.
 
That's strange, I need more context.
 
You want the class name to be templatized? What's that good for?
 
@FredOverflow : Ok. I have a function that only makes sense for int containers. So it might be vector<int> or list<int>.
 
That won't work, because different containers take different numbers and kinds of template arguments.
 
10:52 AM
While this isn't really important, it seems worthwhile to know how to do this.
 
You do this by not doing anything.
template<typename Container> void foo(Container& c);
 
@FredOverflow : Well, lets say the containers in question all take one typename template argument
 
Then you need template templates.
 
@LucDanton : If I pass vector<double> will it crap out.
 
At best you can sprinkle some static assertions, perhaps on`std::is_convertible<int, typename Container::value_type>` but that really depends on what you want to do with the container.
 
10:53 AM
@FredOverflow : I was trying to.
 
@FaheemMitha Yes. There isn't anything better than that. Sorry.
 
@LucDanton : So no easy way to do that then. Ok, no big deal.
Thought I might be missing something.
@LucDanton I just want the template to e.g. accept vector<int>, list<int> but reject say vector<string>, list<string> etc.
 
@FaheemMitha There is no container that takes only 1 template argument. Even vector takes two (the element type and the allocator).
 
@FaheemMitha static_assert on value_type and some type trait.
 
@FredOverflow : Hmm. I see. I forgot about that.
 
10:56 AM
Your constraints should be expressed in terms of semantics, not syntax (i.e. not whether the container is a template with one argument that is int).
Well, at least those are generic programming best practices.
 
Why doesn't foo(ok) work in this SFINAE code?
 
Because std::enable_if doesn't have a value member :)
 
And template templates refuse to ignore default template values, right?
I don't think I said that quite right.
 
@LucDanton ouch :)
 
In any SFINAE is for overloading, not for concept checking...
 
11:04 AM
But couldn't one work around that with template aliases?
 
@FaheemMitha I still don't understand why you only want to allow containers of ints. If other types don't work, you'll get a compiler error, anyway. If they do work, you would unnecessarily constrain your clients. What if someone wants to use a checked_int or logged_int or atomic<int>?
 
@FredOverflow Oh, I forgot about SFNAE.
@FredOverflow Well, up front errors are supposedly better. And the function in question won't accept ints anyway. But it is not a big deal.
@LucDanton You don't approve of SFINAE for such things?
 
Yep. Again, SFINAE is for overloading. static_assert (and similar) is for hard errors.
 
11:12 AM
@LucDanton Well, depends on whether unsigned ints should be allowed or not. Faheem said he only wanted ints.
 
1 min ago, by Luc Danton
Yep. Again, SFINAE is for overloading. static_assert (and similar) is for hard errors.
I don't usually have to repeat my point thrice with you. I don't know what's up :(
 
3 mins ago, by Faheem Mitha
@LucDanton You don't approve of SFINAE for such things?
@LucDanton My name is not Faheem.
1 min ago, by FredOverflow
@LucDanton Well, depends on whether unsigned ints should be allowed or not. Faheem said he only wanted ints.
And this point is not about SFINAE. It's about whether unsigned ints should be allowed or not.
 
@FredOverflow Yes, I have a totally different opinion on SFINAE vs hard errors when addressing you.
@FredOverflow It's irrelevant. You can keep the std::is_same test if you want to.
Regardless of SFINAE or not we can't pick the 'right' concept/trait to check for since we don't know the actual requirements.
 
Well, replacing two things at once and stating that it now works kind of implies that both things are essential :)
@LucDanton agreed
 
@FredOverflow "It's sensible", not "it works". Neither was essential.
 
11:16 AM
Anyway, I agree the static assertion is nicer.
 
Sorry guys. Link keeps dying on me. Thanks for the help. I didn't mean to start an argument.
 
@FaheemMitha What do you think chat rooms are for, if not arguments?
 
@FredOverflow Heh.
 
hi
 
@FredOverflow Unsigned ints would work too. As far as requirements go, I have a container that I'm filling with ints. I'd prefer if the function bombed if I passed it say a container of doubles.
 
11:20 AM
@FaheemMitha Do you read from or write into the container?
 
sbi
 
@FredOverflow : Write to.
I mean, the function is templated on a container that then has ints put in it.
 
@sbi: Did he write C++ as well?
 
sbi
@hochl No, back then FORTRAN was still en vogue.
 
11:36 AM
@FaheemMitha And why would it be wrong to write into a container of doubles in your case?
 
@sbi did he really say that?
 
@daknøk Of course he did, look at the picture!
 
sbi
Abraham Lincoln (February 12, 1809 – April 15, 1865) was the 16th President of the United States, serving from March 1861 until his assassination in April 1865. He successfully led his country through a great constitutional, military and moral crisis – the American Civil War – preserving the Union, while ending slavery, and promoting economic and financial modernization. Reared in a poor family on the western frontier, Lincoln was mostly self-educated. He became a country lawyer, an Illinois state legislator, and a one-term member of the United States House of Representatives, but fai...
 
It must be fake.
I'm bored, gonna write an IDE which uses clang for autocompletion.
 
sbi
@daknøk Note the dates.
 
11:38 AM
He clearly envisioned the Internet and all its problems way ahead of time.
 
He was a visionary, he coded through a medium/seer in the future. Actually he works in our department.
 
@FredOverflow : Hmm. In this case, I guess it wouldn't do any harm. But in numerical work one tends to develop a phobia about converting between different numerical types because of rounding issues.
 
@FaheemMitha Every 32 bit int can be converted into a 64 bit double without any loss of precision.
 
please critise my algorithm ( sort ):

http://pastebin.com/fQx4jpQ1
 
@user1131997 You misspelled "SortBubble" as "SortHeap".
 
11:45 AM
I'd rather criticize the formatting, but coding style is debatable :D
 
Also, unnecessary recursion.
Also, you don't need a semicolon after the body of a for loop or an if statement.
 
@hochl what does the work "debatable" mean? :) I really don't understand the meaning of this word :)
 
@FredOverflow Again again
 
Also, lines 10-12 can be replaced by a call to std::swap.
 
@FredOverflow Please, tell me is exactly "not needed" to put semicolon or it's warning stuff to put it?
 
11:47 AM
Also, the check i != length - 1 can be removed if you make the loop loop once less.
 
@FredOverflow about std::swap , the aim is not using something ready
 
@user1131997 Blocks need no semicolon.
@user1131997 So it's homework?
 
@FredOverflow and what does need? only after class/struct/union ?
 
@user1131997 Yes, class bodies need a terminating semicolon.
 
@FredOverflow it's not a homework, it's better to say, own stuff to own training
 
11:50 AM
And:
in bin, yesterday, by user1131997
void SortHeap(int *buffer, int length)
{
bool again = false;

for(int i = 0; i < length; i++)
{
if(buffer[i] > buffer[i + 1] && i != length - 1)
{
again = true;
int tmp = buffer[i + 1];
buffer[i + 1] = buffer[i];
buffer[i] = tmp;
};
};

length--;

if(again) SortHeap(buffer, length);
}
 
#define compLT(a,b) (a < b)
#define compEQ(a,b) (a == b)
@sehe WTF?
 
@user1131997 It means that you can have very long discussions about how to format source code and everyone has other views on this topic.
 
I didn't say that RB-tree is my code :) it's not only visible on style, but also in log exaclty

it's very good, that you have posted links, so everyone can try find , where have I say, that is my code :) I only posted and tell to critisie with owning the code ;)
 
Aren't red-black-trees impossible to get right?
 
@user1131997 It is not about that. I don't mind you asking questions on someone else's code
 
11:53 AM
It's just strange that you post C code in a C++ room.
 
@FredOverflow It's abstraction! What if the definition of "less than" changes?
 
@FredOverflow RB is ok, AVL is the hard type (AVL is marginally 'better' though)
 
@sehe not, it is ;) because it's clear as a crystal :)
 
@user1131997 No. It is mainly about wasting our time without mentioning the context. You can hardly keep barging in here and throw walls of code at us without any further explanation and demand full attention.
5
@user1131997 On top of that you accompany the most complex CS topics with the most basic language questions.
 
@sehe I think, it's not the best way to speak for the all people :) let all another people be free from your oppinion ;)
 
11:56 AM
I've heard there's a pretty cool website you can visit for answers to programming questions though. I wish I could remember its name... Starts with "queue" or "stack" or something....
 
@user1131997 Lastly, why where you suddenly AWOL yesterday, when I first posted this?
 
@sehe If you don't like my answers, quotes etc , you are free from making attention exactly on my stuff :)
 
@user1131997 Your answers? I think it's your questions that are the problem
 
@user1131997 I do agree to that. I could have chosen not to warn @FredOverflow. So let me make you this deal, I won't try to influence other people, but I'll address you when I think you cross a line. Thanks for correcting my approach there.
 
@jalf try to look at history , there were not only quesions, but and answers sometimes too
@sehe I think, that crossing the line is written in rules on this site, but without your action of marking my behavior on this site
 
12:02 PM
@user1131997 I remember once. I'm not complaining about you being here. I'd rather you choose your question more carefully to avoid wasting our time (and yes I speak for myself, but I mind about others time as if it were my time)
@user1131997 That's why I say I'll address you next time, not the mods. This is a community, and as such, my norms and wishes count as much as yours
 
@user1131997 Why do you refuse to use C++ language features? The "You must learn C before C++" school of thought has long been deprecated.
5
 
@sehe let other people speak only for themselves ;) more making attention at your authority on this site, than more you make , that it's not the highest, cause people with real authority won't present this as argument in controversy
 
Anyway, as long as there's not much going on here, I don't oppose to strange C code being posted here.
I just don't see the point.
 
cause many where and in embedded development there is no C++ support and for NXP-drivers and for smth else... may be in future , when you develop microcontroller's programs there will be popular some high-level languages

j2me or .net microframework are not the best solution and I don't think, that there is sense to give much links from google about 2 technologies
 
@user1131997 So you're an embedded systems programmer?
 
12:09 PM
@FredOverflow : Yes, I know. Like I said, in this case it is ok.
 
@FredOverflow no, but trying to work with it by myself
 
@user1131997 You're doing embedded systems right now or not?
 
@user1131997 so far, 3 people has agreed with @sehe. Please, don't try to hide behind that. If someone here, or elsewhere, objects to your behavior, please don't just react with "yeah but you don't speak for everyone, so I'm going to ignore your complaint"
 
@FredOverflow yes, right now on NXP products
 
@user1131997 You're actually doing exactly the same by assuming you do nothing wrong you also assume to have the authority to say that your way of using this chat/site is the correct one
 
12:10 PM
because I really don't want to have to shout "ME TOO ME TOO I AGREE" every time someone here says something sensible
 
I don't think this discussion is necessary. If someone posts something which doesn't belong here, he won't get much help, and sooner or later he'll stop posting.
 
@FredOverflow you underestimate trolls :p
 
to do the same I must use the authority, which I don't have, so only by logic, I'm not doing the same

and about your conclusion you are right, I'm not crossing the line of using chat, so I'm able to do , what I have did before

may be only to correct posting code :)
 
@jalf It'd like to have up/downvotes for it.
 
@FredOverflow Indeed :) it's the best way to pop from any community ;)
 
12:14 PM
@Abyx we have stars. @sehe got 3 for it so far
 
sbi
@jalf Me neither! Me neither! I fully agree with you!
 
@user1131997 why do you write \n\n instead of single one?
 
@user1131997 if 4 people here think you are crossing the lines, and no one has spoken out in your defense, then you are crossing the lines
Please, don't be a dick. Do we really need to write down that rule in order for it to count?
 
@jalf stars is for starring shit, not to agree\disagree
people mostly (ab)use stars just for funny messages, like "I'm stupid, it's official"
 
@user1131997 You have violated the unwritten rule that "if someone here thinks you are behaving badly, you deal with it seriously". Simply saying "you don't speak for everyone" is not really helpful
@Abyx that doesn't mean they can't also be used to express agreement
 
12:16 PM
@Abyx just I like double \n
 
@user1131997 the rest of us like being able to read more than the last three messages on screen at the same time though. So don't take up more space than you need to
it's for the same reason that we discourage posting a wall of code here
 
@jalf I think crossing the line is able on the rules, which you view on this site, but not exactly from yours, if tommorow you want me to give you keys from my car or home, just you think I'm crossing the line, will I do it? Of course, no
 
also, when you star something, another funny starred message disappears from list at right.
 
@user1131997 I don't care about your car keys, and I don't see what they have to do with anything. But this chat room is not StackOverflow, and StackOverflow's rules do not apply universally here. This is a chat room with its own rules and guidelines
and if you insist on breaking them then you are a dick and should go elsewhere
if this room had a rule that "everyone here need to give me their car keys", then yes, you'd have to do that if you wanted to be here. Of course, you could just leave the chat if you didn't agree with the rules
 
@jalf it's not polite to name someone "dick", doesn't your mom bring you up to be polite even in stress situation, I can send you some good tea to make you kind ;)
 
12:20 PM
but we don't have lame rules like that. We just have simple, straightforward ones such as "don't piss off others needlessly", and "don't use this chat as if it were SO. If you have serious programming questions involving a lot of code, post them on SO, not here"
 
sbi
@user1131997 Well, FWIW, I think when you have disgruntled two long-time users here of whom I think much, you already have crossed the line. So what's it gonna be now? Should we move everything you say to the bin? Should we flag you to give you time to cool down, reconsider, and come back afterwards? Should we ask a mod to step in? Or are you gonna adapt to what the community here wants?
 
@user1131997 when you behave like a dick, you are dick. it's not about politeness.
 
@jalf you know, there is right-down corner and some good links as help, faq, legal, you can try to read it and think about definitions "rules of chat"
 
@user1131997 Isure, i'd like some tea. But that still doesn't mean it's ok to ignore the rules here
 
@Abyx I think dick isn't able to type on keyboard, cause it can't do it ;)
 
sbi
12:22 PM
@user1131997 This is not about the rules of the chat, it's about the culture of the community you barge in on.
 
@user1131997 sure, I've read it. And you could try to read what admins and mods have said on the subject previously: chat rooms largely make their own rules
we're not allowed to break the "big" rules, the ones that would get StackOverflow in trouble (no child porn, please)
 
@Abyx politeness helps.
 
but we are absolutely allowed to impose our own community rules
 
hey, has there been a flame war that i missed out on? :-(
 
the moderators have made that clear several times
 
12:23 PM
@sbi about culture, try to find where have I named somebody dick, and think about definition "culture"
 
@user1131997 now tell me, why are you here? If you want help, you'll get it by conforming to the rules and playing nice. If you want to socialize, I can also recommend respecting the community here.
The only reason I can see for insisting on violating the rules of the community you barge in on is trolling. Are you a troll?
 
Gents. Shall we just let it go? I think the point was made: I'm sure people will be more careful demanding attention in the future. I will be more direct in my approach when voicing my concerns. Sorry @FredOverflow and @user1131997
 
sbi
@user1131997 It's part of the culture of this room to call someone who behaves like a dick "a dick", straight-out, to their face. If you don't like that, you might want to ask elsewhere.
2
 
@sbi To be honest, I think @user1131997 has shown remarkable calm in his responses so far. (I'm sure I've missed some, so perhaps there were exceptions that I haven't seen).
 
@sbi it's part of culture of this room to name smb. "dick", isn't it?
 
12:26 PM
if you want to be pedantic, I don't think I said you were a dick. I believe I only talked about an unwritten rule that you should not be a dick.
 
@sbi your words, not mine ;)
 
@user1131997 smb?
as in Samba?
 
@jalf smb == SoMeBody
 
Rhumba :)
^^ me diluting the vertical conversation space
 
sbi
@user1131997 Didn't I just say that? (And don't try to test that by naming me a dick. You don't think your evaluation of me is even marginally of interest to my ego, do you?)
@sehe That would be rmb.
 
12:28 PM
@user1131997 yes, it is part of the culture of this room to call someone "a dick" if they behave badly. That's just how it is. It's also part of the culture of this room to use other swearwords when we feel like it. No personal offense is intended, but that's how this room is
 
Beguine, Foxtrot
Just throwing in some more dance rhythms for good measure
 
@sbi Yes, you have said, that naming somebody dick is the legal form of polite here ;) intersting, do you have a girlfriend? Try to go together with her to the cinema , but not protecting dickable rules in this room ;)
 
@user1131997 I think we should leave his personal life out of this
and the cinema is not this room, and thus the rules of this room do not apply to the cinema
 
@user1131997 there is no need to protect this rules. they just exists.
 
sbi
@user1131997 It's not considered polite, but sometimes it's considered necessary. As for girlfriends — I have more kids than many here have had girlfriends, and might have had more wives than some had girlfriends. So what about it?
 
12:30 PM
@jalf Where did I connect to his life, you giving advice to go with girlfriend
so , if you are so busy and well father and etc, you might have a lot hard problems, that must make you free from thinking about "dick" definition in this room :)

I have only girlfriend, not family ;) so I have free time to chat about absent-minded definitions and yes, it's bad, I'd better to do smth. good and useful , but not chatting here
 
I long for a mute button
 
May be it's better for me to go to the cinema, all right! :) good bye , guys
 
@user1131997 You know, appending a smiley to everything you say does not make it appear friendlier or smarter
2
 
@jalf :) lol. :D ^_^
 
@jalf I hope it doesn't make it stupider ;)
 
sbi
12:35 PM
@user1131997 I have no idea what you're talking about, and, frankly, I don't feel like it's worth my time to further investigate. So I will now stop this fruitless discussion with you. Plonk.
 
anyway, I was promised tea, and he never even asked for my mailing address!
 
sbi
8
A: Pass Nothing from Javascript to VBScript in IE9

mixelQuitted job. Found a better one.

Haha!
 
lol, seems like people have been discussing "dick" here for the past half an hour.
 
sbi
The next person to call me a 'meta cop' will be issued a speeding ticket for typing too fast.
I think we might have disgruntled him, too.
 
meesa show
 
12:46 PM
@sbi nice
 
@tinkertim Meta Cop!!! ( lol, followed you so I could reply to this. )
 
@sbi a moderator who can't handle users disgruntling him is in trouble already
 
sbi
@IntermediateHacker I was faster. (Also, I don't think you need to follow someone to send them a message.)
 
hmm, I don't think I've ever used the term specifically about moderators. As far as I'm concerned, the meta police is the population on meta
 
sbi
@jalf I think he handled it pretty well. He was hurt, though.
 
12:48 PM
@jalf He handles it!
 
@sbi oh, didn't notice your reply. lol.
 
@sbi hurt? Is there a specific episode we're talking about?
 
sbi
yesterday, by Tim Post
@sbi Fine. I'm not really a person. I'm a bot that the other moderators wrote to spy on you. Better?
 
@sbi woah. looks like he's really pissed off.
 
Tin
hi guys, is there any of you familiar with cmake files? i've been trying to add -std=c++0x.
 
Tin
The error that i get is: cc1plus: error: unrecognized command line option "-std=c++0x" in pastebin.com/RZbpx9NH
 
@sbi now there are even possible duplicates in chat?
 
@Tin check what the actual command line ends up being
can't you make gcc log that?
oh, you're using add_definitions? Check the docs
it's only for adding defines
not arbitrary compiler flags
 
you know, I just found a lot of uses of the python interpreter. it's actually quite more than just an interpreter, it can also be used as a programming tool, command line etc.
2
 
Tin
I'm using add_definitions
 
12:57 PM
@Tin Yeah... That's what I just said. :)
 
Tin
from that document, to add the compiler flags, one needs to add the D, right?
-Dstd=c++0x ?
 
-D adds a #define, sort of.
 
oh, never mind
> This command can be used to add any flags, but it was originally intended to add preprocessor definitions
fuck you, cmake
6
 
premake4 ftw
 
12:59 PM
I don't know about add_definitions, but set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") will work.
 
well, figure out what command line it actually generates, and see if that is what you expected
 
@Tin What GCC version?
 
1 hour ago, by jalf
I've heard there's a pretty cool website you can visit for answers to programming questions though. I wish I could remember its name... Starts with "queue" or "stack" or something....
lol.
 
Tin
gcc/4.6.1
@CatPlusPlus, after adding your suggestion, I get the following error: cc1plus: error: unrecognized command line option "-std=c++0x"
 
Can you run g++ -std=c++0x manually?
 
Tin
1:02 PM
yes, i doubled check it, sth. like: g++ -std=c++0x main.cpp -o main.o and it worked
 
Well, look into generated makefiles.
 
then cmake probably applies some weird transformation to your specified flags
 
Which CMake version?
 
check the generated makefiles, see what parameters are actually passed to g++
 
Tin
cmake version 2.8.0
 
1:07 PM
When using CMake you can see the full command line by typing: make VERBOSE=1
 
Tin
this is a partial example of how the makefile looks like: pastebin.com/LWLZ3wgK
 
> I hang out in the Lounge<C++>, which is full of cool and smart people who like to discuss se stuff.
@CatPlusPlus lol @ se
 
@Tin The real makefile is CMakeFiles/Forest.dir/build.make.
 
Tin
@StackedCrooked, thanks, this is the full command: `/usr/bin/c++ -std=c++0x -I/xxxxxxxx/local/boost_1_46_1/include -I/xxxxxx/libconfig-1.4.7/include -I/usr/local/include -I/usr/include/libxml2 -I/usr/local/Matlab/extern/include -O3 -msse3 -mfpmath=sse -fopenmp -o CMakeFiles/Forest.dir/Forest.cpp.o -c /xxxxxxxx/Forest/src/Forest.cpp
cc1plus: error: unrecognized command line option "-std=c++0x"`
 
1:12 PM
What is the output of /usr/bin/c++ --version ?
 
So, it's not using g++, it's using c++.
Regenerate the cache with correct compiler.
 
afternoon gentlemen
 
cmake -DCMAKE_CXX_COMPILER=g++ ...
 
Tin
can i delete the CMakeCache.txt, right?
 
The entire cache directory.
 
Tin
1:13 PM
the output is: c++ (GCC) 4.1.2 20080704 (Red Hat 4.1.2-50)
 
You do generate the cache outside of the source, right?
 
@StackedCrooked yes
 
@Tin GCC 4.1.2 doesn't support C++11.
 
@Tin And there's your problem.
 
Tin
i was explicitly selecting gcc/4.6.1 before calling the cmake, mmmm, let's see what happens if i delete the cache
so, it means, directories: CMakeFiles, UnitTests, and file CMakeCache.txt
right? anything else?
and also cmake_install.cmake, right?
 
1:17 PM
The entire directory you ran cmake in, unless you generate the cache inside the source tree, which you shouldn't do.
 
Damn, the only notification I've got on fb for the past three days is <Idiot> sent you a request in Farmville . :'(
 
Tin
the source tree is in the same directory of the cache
 
and my mom gets 7~16 daily.
I'm even less popular than my mom.
 
mkdir build; cd build; cmake <options> ../
 
@FredOverflow Actually, @Alf's solution is quite clever and also ...a different kind of ugly :D
Or: rm -rf Build && mkdir Build && cd Build && cmake .. && make
 
Tin
1:21 PM
now the output looks something different, after deleting the cache:
`/xxxx/apps/gcc/gcc461/bin/g++ -I/cluster/xxxxxxxxxx/local/boost_1_46_1/include -I/cluster/xxxxxxxxxx/local/libconfig-1.4.7/include -I/usr/local/include -I/usr/include/libxml2 -I/usr/local/Matlab/extern/include -O3 -msse3 -mfpmath=sse -fopenmp -o CMakeFiles/Forest.dir/Forest.cpp.o -c /cluster/xxxxxxxxxx/libs/Forest/src/Forest.cpp
In file included from /cluster/apps/gcc/gcc461/lib64/gcc/x86_64-unknown-linux-gnu/4.6.1/../../../../include/c++/4.6.1/random:35:0,`
 
You usually don't need to regenerate the cache from scratch.
@Tin That's only a part of the error, which says nothing.
 
@CatPlusPlus Took me a while of staring before I realized there's no error there.
 
Tin
this is the second part:
`/xxxxx/apps/gcc/gcc461/lib64/gcc/x86_64-unknown-linux-gnu/4.6.1/../../../../include/c++/4.6.1/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options.
In file included from /xxxxxxxxxx/libs/Forest/src/tree.h:6:0,
from /xxxxxxxxxx/libs/Forest/src/forest.h:4,
from /xxxxxxxxxx/libs/Forest/src/forest.cpp:3:
/xxxxxxxxxx/libs/graz/Forest/src/utilities.h: In function ‘double randomDoubleEngine(Generator&, double
in the CMakeLists.txt I added: SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
 
@Tin Is it the correct CMakeLists, and are you sure it reaches that?
 
Tin
when I call the refered file, I go to the same location directory, where the CMakeList is and then I do: cmake CMakeLists.txt
does the SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") should be placed at a specific position in the CMakeLists.txt file? or it doesn't make a big difference?
 
1:31 PM
You don't pass CMakeLists to cmake.
Show the entire file.
 
Tin
in line 42, i did a hack, not sure whether it's fine:
#FIND_PACKAGE(Boost 1.36 COMPONENTS program_options system filesystem REQUIRED)
SET(Boost_INCLUDE_DIR /xxxxxxxxxxlocal/boost_1_46_1/include)
SET(Boost_LIBRARY_DIRS /xxxxxxxxxxlocal/boost_1_46_1/lib)
I need boost 1_46_1 or higher, so I installed it locally and therefore needed to comment the FIND_PACKAGE line
I replaced the correct path, with the xxxx
 
Move it after PROJECT().
 
Tin
you mean the SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x"), right?
 
And that path censoring is silly.
Yes.
 
Tin
how could I then oblige that the FIND_PACKAGE looks first locally
in the server, where I'm compiling the code, the installed version is older than 1.46.1
after placing it, after PROJECT() it's compiling properly now! thanks a lot
but how could i still avoid the path censoring?
any suggestions?
 
sbi
1:57 PM
@jalf See, this is what all CMake talk ultimately will arrive at, sooner or later: "fuck you, CMake!
 

« first day (493 days earlier)      last day (4454 days later) »