« first day (65 days earlier)      last day (4875 days later) » 

7:15 AM
I get a bunch of errors like this while compiling my code:
/u/ac/alanger/gurobi/gurobi400/linux64/lib/libgurobi_c++.a(Env.o)(.text+0x1034): In function `GRBEnv::getParamInfo(GRB_StringParam, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
: undefined reference to `__stack_chk_fail'

This error comes only one some machines
On Googling I found that I should put -fno-stack-protector in the compile time falgs
But I get this error with this flag:
cc1plus: error: unrecognized command line option "-fno-stack-protector"
Can anyone please put some light on this?
 
7:29 AM
Alright! It seems to be because of some version mismatch between gcc version of the pre-compiled libraries and the gcc i am using
 
8:04 AM
all the rep whores, you can earn some rep
4
Q: Boost logging - destinations and formatters

TonyI am having a problem with using Boost Logging library, that if I add a formatter or a destination to a logger, using my own Log class, I cannot change that destination or formatter. Does anybody know how to change the destination or formatter on a boost log object? The scenario I have is tha...

 
sbi
2 days ago, by Tony
@sbi do you think its possible to give a custom dynamic writer a notion of which logger that asked for a write?
@Tony For templog, that's doing it wrong.
In templog, you would use the loggers to filter log output so that, whatever you wouldn't want to see, won't even reach your writer.
OTOH, IIRC there's some origin information in your log message, so you might be able to filter by that. ICBWT.
yesterday, by Tony
@sbi for the templog do you add the headers to your project or do you add an include reference to the project properties?
@Tony ISTR the only relevant cpp file being the one with some Win32 logger. Considering the problems of a lib (need to be compiled with the exact switches the app it's linked into is compiled with), I just threw the few files into my app and was done with it.
 
 
4 hours later…
12:33 PM
@sbi thanks for your help
I've changed my strategy to something simpler
cause logging to file per request is just too hard
 
12:59 PM
I have a project in VS2003 that has several sub projects, and I've managed to get a circular dependency, what would be the best way to remove it? Put the bits from Project A that depend on B into some project C, so that B can now depend on C and A depend on B, if that makes any sense?
 
 
2 hours later…
2:47 PM
stackoverflow.com/questions/4489639/… Oh no, it's a more advanced question than it seems (at least according to the poster). It's certainly too advanced for me to understand.
 
sbi
2:58 PM
@Charles I added a comment explaining why I down-voted.
@Tony I'm not sure what you're referring to. (I haven't been much online since Friday morning, so I must have missed seomthing.)
 
@sbi I wanted to create a new file for each request my server component receives
a log file that is
@sbi hoping your graphics card troubles have been resolved :)
 
sbi
@Tony A new logfile? In templog you would create a new dynamic logger for that, I guess.
 
I've given up on that road, its too complicated
just one log file for now
 
sbi
@Tony Yup. The problem disappeared when I undocked my laptop. It just took too very until I got the idea to try that. When I docked it again this morning nothing bad happened (and at home, without a docking station, nothing happened either). So I guess there something (a skin flake? a hair?) between the docking contacts.
Bugger of a problem, though. Stole me the whole day.
 
@sbi I can only imagine the frustration
 
3:40 PM
Because you can't downvote comments you sometimes get these "upvote-the-other" wars going on. Vote for Billy ONeal if you think that adding a return 0; at the end of main is unnecessary. Vote for ereOn if you think that you should. stackoverflow.com/questions/4490688/…
 
4:05 PM
isn't it kind of nit-picky either way?
 
4:19 PM
Well, yes!
 
4:39 PM
Quiz time, what does the following evaluate to? ;-)
a<b?b<c?b:a<c?c:a:a<c?a:b<c?c:b
 
@FredOverflow you've lost me
 
@Tony It calculates the median of a, b and c :-)
(i.e. the number that is neither the minimum nor the maximum value, assuming all three values are different.)
 
ok
 
0
Q: Is the ternary operator evil?

FredOverflowFor example, would you prefer this one-liner int median(int a, int b, int c) { return (a<b) ? (b<c) ? b : (a<c) ? c : a : (a<c) ? a : (b<c) ? c : b; } or an if/else solution involving multiple return statements? When is ?: appropriate, and when is it not? Should it be taugh...

 
@FredOverflow did you not just give away the answer to your quiz?
 
4:43 PM
@Tony Like anybody else cares :)
 
doesn't look like it
 
Most programmers are probably familiar with it, anyway.
 
then I'm not amongst most programmers yet I guess
 
@FredOverflow That use of it is evil
a<b?
    b<c?
        b
        :a<c?
            c
            :a
    :a<c?
        a
        :b<c?
            c
            :b
 
it confuses n00bs like me
 
4:45 PM
but indention solves anything
 
so if you have a .h file looking as such
#ifndef REQUESTHANDLES_H
#define REQUESTHANDLES_H

#include "stdafx.h"

HANDLE hRequestProducer;
HANDLE hRequestConsumer;

#endif
 
it's the standard form to only define things once
 
and you include it in another .h file A, then you include that file into some .cpp file, could that create a multiple defintion error on the linker?
 
no, the compiler will only include it once
 
@CRoss I like this formatting better:
a<b?
    b<c?
        b
       :a<c?
            c
           :a
   :a<c?
        a
       :b<c?
            c
           :b;
 
4:47 PM
because of the @ifndef structure
 
so why is my compiler giving me errors then
that it has found multiple defintions
 
@Tony of what?
 
of those variables
 
@Tony You don't define variables in header files, you merely declare them with the extern specifier. The definition goes in one cpp file only.
Header guards only protect against multiple inclusions of the header in the same translation unit, not across a "project".
 
@FredOverflow so does this wreck it then: 	ReleaseSemaphore(hRequestProducer,1 ,NULL); //Signal producer that a new string was added
thats inside a member function
and I've included the .h file with the declarations in that cpp file
 
4:50 PM
I was referring to the definiton HANDLE hRequestProducer; (and the one below) inside the header file. They don't belong there.
 
so they belong where?
 
@Tony As I told you, in a cpp file. And inside the header file, you must add the extern specifier to mark them as declarations instead of definitions.
 
if you really need them globablly
 
but what if I want to use them across cpp files
 
Again, you declare the variable in the header file: extern int global_variable; and you define it in one cpp file: int global_variable. Anyone who includes the header has access to it. It does not matter in what cpp file it is defined.
 
C and C++ make the spotting the difference between a declaration and a definition so much more complex than it could be.
 
@CharlesBailey I concur
I had no idea until @sbi & @FredOverflow pointed it out
 
The trouble is there are well defined concepts such as storage duration, linkage and then we have a bunch of keywords: extern static const many of which have an effect on the concepts but not in a neat orthogonal way.
 
@Tony: So, did it work with extern?
@CharlesBailey Did you ever expect C++ to behave neat and orthogonal? ;)
 
Not for some time now.
 
5:00 PM
@FredOverflow I added extern to those declarations in the header file
not solved
 
E.g. extern int a; - ok to have in multiple TUs as it's just a declaration. extern int a = 1; now it's not because it's a definition. int a = 5;, not ok; const int a = 5;, ok now because it has internal linkage.
 
@Tony And did you also put HANDLE hRequestProducer; in a separate cpp file?
 
not yet
 
@Tony Of course it doesn't work then, because the linker cannot find a definition. He will complain about an "undefined reference to blah" or something.
 
added a cpp file:
#include "stdafx.h"
#include "RequestHandles.h"

HANDLE hRequestProducer;
HANDLE hRequestConsumer;
 
5:04 PM
@Tony ...okay, and what happens? does it work?
 
nyet
 
@Tony I guess that means "no"? Or "not yet"? What does the compiler say?
 
it complains about syntax errors; and missing class-storage specifiers
 
post the h file content
 
#ifndef REQUESTHANDLES_H
#define REQUESTHANDLES_H

#include "stdafx.h"

extern HANDLE hRequestProducer;
extern HANDLE hRequestConsumer;

#endif
 
5:06 PM
and the exact errors messages
Where does the type HANDLE come from? Don't you have to include something to get it?
 
error C2086: 'int HANDLE' : redefinition
: see declaration of 'HANDLE'
HANDLE is a void*
 
yup, the compiler does not know that HANDLE is supposed to be a type, because you haven't defined it anywhere.
@Tony I don't see that from your header. Where is HANDLE defined? In another header? Then include that in your header. Headers must be self-sufficient.
 
windows.h is where it is defined
 
Hi! I am getting this undefined reference error while compiling my C++ code:

undefined reference to `__stack_chk_fail'
 
What, why does the compiler say int HANDLE? Are you using HANDLE both as a type name and a variable name (of type int)?
 
5:09 PM
Can anyone put some light on this?
 
@Tony Then you must include windows.h in your header file, easy as pie.
#ifndef REQUESTHANDLES_H
#define REQUESTHANDLES_H

#include "stdafx.h"
#include <windows.h>

extern HANDLE hRequestProducer;
extern HANDLE hRequestConsumer;

#endif
@Akhil Google turns up this thread.
 
Yah, I tried putting -fno-stack-protector, error still exists
 
5:24 PM
Various forums suggest adding -fno-stack-protector while compiling and it solved many peoples problems but not mine
 
sbi
5:35 PM
@FredOverflow It! Your German showing. :)
 
@Tony Does the absence of further questions indicate that it works now?
@sbi Oops :-)
Btw I'm thinking about reading It in english.
Read it in german as a kid and was scared to death.
 
@FredOverflow Most Americans think everything is scarier in German :-)
 
Anyone else hear music?
Ack nvm
 
6:19 PM
Hi! I am getting this undefined reference error while compiling my C++ code:

undefined reference to `__stack_chk_fail'
-fno-stack-protector didn't help
Nor did empty function implementation in my code void _stack_chk_fail(void) helped
 
@FredOverflow thx yes I works
sorry had to go do something not computer relatd
 
7:05 PM
@Tony You betrayed your computer with some non-computer related stuff? How could you?
2
 
yea I'm being naughty
hehe
 
7:27 PM
@Tony What is naughtier than undefined behavior??!
 
defined behaviour
:p
 
@FredOverflow unindented & spaghetti code.
 
7:49 PM
what's up
 
@JohannesSchaublitb std::ceil, I suppose.
 
Laaammmmmeeeeeeee
 
no, C++ is up
C-- is down
 
8:20 PM
hehehe
:p
 
8:37 PM
@JohannesSchaublitb Carl Sagan can tell you what's "up":
 
is there a way to use cpp live on the terminal for OSX?
 
sbi
9:07 PM
4
Q: Why can't I find unregistered users in user search?

sbiThis is a follow-up question to Why do user pages not show up when searching through user pages? where KennyTM pointed out that the user in question isn't registered and therefore can't be found. This raises the question, why is a user who has answered questions, and has a user page, not findab...

This could use some visibility, so I'm dropping it here. :)
 
9:21 PM
Thx @sbi
 
sbi
@Tony Huh? What for?
 
for making sure we get to see interesting questions :)
 
 
1 hour later…
10:46 PM
@sbi +1 for more visibility.
 
sbi
11:13 PM
@James Thanks!
 

« first day (65 days earlier)      last day (4875 days later) »