21

I just asked this question:

https://stackoverflow.com/q/37854282/1593077

regarding the meaning of an error message. Within a few minutes I was downvoted 5 times, and 3 people demanded that I post code.

Is it really inappropriate to ask for help understanding error message text, rather than help in fixing a piece of code?

12
  • 16
    Maybe it's because there are so many Google results for this exact error. Sometimes people feel like they are being abused for such "petty questions". It's an instinctive disliking. (Not saying this is right or wrong, but it might explain where the downvotes come from.)
    – usr
    Jun 16, 2016 at 21:08
  • @usr: But there are actually few Google results for this message.
    – einpoklum
    Jun 16, 2016 at 21:18
  • 3
    26, but I'm not qualified to determine whether any of them would help you.
    – usr
    Jun 16, 2016 at 21:24
  • 33
    You are getting downvoted because you are expecting people to help you but are reluctant to post the necessary information. People are annoyed you feel it is too much work for you to ask the question properly. Out of context, an error message could many many things. How is someone supposed to help you with that, you think we know off the top of our heads all the possible reasons for every obscure error message? To properly answer your question, we need more information. It's like saying "my stock portfolio lost money, please tell me why but I don't want to explain what investments I have.
    – pilavdzice
    Jun 16, 2016 at 22:20
  • Building on @usr there's also a natural dissatisfaction when you ask for a pyramid and don't supply the material's. Aka Asking for an impossible favor.
    – userDepth
    Jun 16, 2016 at 23:50
  • @usr I found significantly more... a few hundred thousand; 236 when quoted exactly
    – TylerH
    Jun 17, 2016 at 16:19
  • @TylerH I searched in quotes and navigated to the last page to force an accurate tally.
    – usr
    Jun 17, 2016 at 16:24
  • 2
    You did not do your homework. See stackoverflow.com/a/14596065/53897 for an explanation. Jun 18, 2016 at 17:20
  • Providing context can help tremendously when trying to answer a question. Someone may have seen the error you're getting and solved it but not quite remember when or where. Providing an MCVE could help them remember. Plus, you may only be getting a particular error message due to some factor of your context. You were downvoted appropriately Jun 18, 2016 at 20:27
  • @Tibrogargan: Look, sorry for repeating myself, but I didn't ask for help solving anything (!). In fact I had already changed other things in my code which made that error go away, and I just wanted to understand what it meant.
    – einpoklum
    Jun 18, 2016 at 20:30
  • 1
    @einpoklum Why you get an error may be a big factor in what the error message actually means. My comment had nothing to do with the question you asked - perhaps someone could explain what "meta" means. Jun 18, 2016 at 20:36
  • What's even more shocking is that there are three close votes, all for the wrong reasons. Jun 18, 2016 at 23:58

4 Answers 4

70

It is perfectly on topic to ask what the compiler message means (assuming it is a unique non duplicate post and the message isn't something direct).

All you need to do is include a snippet of code so that other people can reproduce the compiler message for themselves to properly explain the scenario that caused it if the message is more obscure than usual.

Often compiler messages are used for a large set of reasons, and it is important to include a reproducible example to narrow which reason caused the compiler to error.

19
  • 1
    The thing is, generating an MCVE is sometimes rather painstaking; while, if you just understood the text of the message, you could resolve the problem. Also - if some messages are used for a large set of reasons, an answer could be "This message means X. That can be the case for many reasons, for example Y."
    – einpoklum
    Jun 16, 2016 at 9:12
  • 65
    @ein Any decent answer, in order to explain what that message means, is going to have to include a sample snippet of code that generates the error. If you consult any decent compiler documentation, it will do the same. So it's not really clear to me why you think it's reasonable to expect answerers to do this work, but you are unwilling to do it as part of the question-writing process. Jun 16, 2016 at 9:44
  • 2
    @CodyGray: I don't see how that's the case. The terms "external entity" and "non-external" entity have a meaning which can be explained irrespective of a specific piece of code. In fact, some of the commenters link to such explanations.
    – einpoklum
    Jun 16, 2016 at 11:55
  • 3
    @ein There were two commenters who linked to things, songyuanyao and myself. What songyuanyao linked to (A) contains a snippet of code as an example, and (B) only vaguely explains the terms you mention. In fact, it never uses the word "entity"; it merely alludes to the distinction between objects with internal and external linkage. If you don't already know what the error message is trying to say, I can't see how that would help. Beyond that, if the question is really just "What is a non-external entity?", I think there would be broad agreement on that being a very low-quality question. Jun 16, 2016 at 12:20
  • 52
    @einpoklum: "The thing is, generating an MCVE is sometimes rather painstaking" Right, and that's just another reason why it should be the OP putting in that effort, not the diligent answerer who otherwise has to do it themselves. Anyway, isn't the painstaking debugging the whole point? OPs should be doing that anyway, before asking. Jun 16, 2016 at 19:57
  • @MikeHolt: That was exactly why I refrained from quoting any code, so as not to have people scratch their heads trying to figure out what's causing the errtor. I "distilled" the part of the issue which I though was relatively easy to answer (even if a somewhat general answer) and would be helpful to me and to others.
    – einpoklum
    Jun 16, 2016 at 21:01
  • 12
    Asking a question on SO should be a last resort, not a first choice because it's quick and easy. Jun 16, 2016 at 21:25
  • 8
    @einpoklum The "M" in MCVE stands for "minimal": you should make your example as small as possible. This will ensure people don't scratch their heads trying to figure out what's causing the error.
    – anatolyg
    Jun 16, 2016 at 21:27
  • @anatolyg: Luckily, that's not the question I asked. I specifically said I don't want to know the why, just the what.
    – einpoklum
    Jun 16, 2016 at 21:29
  • 2
    Yeah. I don't mean to be rude in saying this, but the answer you posted is not the type of answer we want to encourage on Stack Overflow. It is not a good, complete, thorough answer. It is a minimal-effort answer, the kind of thing you've always been able to get on web forums and Yahoo! Answers. The person who says, "yeah OK, I'll Google it for you...here are some links". We have a rather different mission statement. Jun 17, 2016 at 6:09
  • 6
    Your comment to the question is similarly indicative of this misunderstanding: "the question could have easily been answered by the one-liner "oh, it's an error message about entities with external linkage, look it up"." No one has posted that because it is not a good answer, and people have downvoted your question because, as it currently stands, this is the only type of answer that could possibly be posted. Which makes it a low-quality question. Jun 17, 2016 at 6:10
  • 6
    @einpoklum The thing is, generating an MCVE is sometimes rather painstaking; and you think providing a complete and accurate answer is a breeze? If you aren't willing to put the effort into your question, which you want answered for free - then you can't expect people to put any effort into answering it, they will quite rightly downvote and move on to the questions that have put that effort in Jun 17, 2016 at 16:12
  • 1
    I really disagree with this sentiment. There have been PLENTY of times when I have gotten vague, obscure, indecipherable & confusing error messages trying to compile some code, and was able to solve the issue only because experience had taught me enough about the meaning of the message and its causes that I knew what the potential cause of the error was. The OP is simply asking if anyone else here has such experience. It does not require a MWE to say "X error is often caused by A, B, and C type errors". Downvoting people with such questions creates a toxic environment. Jun 19, 2016 at 1:13
  • 3
    @user5359531 Downvotes are on posts, not people. A toxic environment comes from disrespect, not using the system as designed to discourage questions that can't be answered effectively. See Dave's excellent answer, which explains quite clearly why these sorts of questions are not high quality.
    – jpmc26
    Jun 19, 2016 at 6:55
  • 3
    @user It's unclear to me why you disagree with Travis's answer. He says, and I agree, that asking about compiler error messages is perfectly on topic. The distinction being made is whether you need to include some code that contextualizes the meaning of the error message. There are indeed plenty of times when compilers give out "vague, obscure, indecipherable, and confusing error messages," and that an expert answer is needed to get to the bottom of the error's cause. But yet you disagree that including code to reproduce the problem would make the question better? Jun 19, 2016 at 7:42
43

Off-Topic is a silly close reason for this question. If I'd done anything with this question, I would have closed as "Too Broad".

But let's suppose instead I tried to answer it. Actually, let's not suppose; let's do it!

OK, so I don't know anything about that error message, but I'm pretty good with C++ and I know how to Google:

  • Error with using a function as a non-type template parameter
    hmm, this person's problem was down to a simple template mismatch in their code (they swapped some parameters accidentally). Maybe your code has a similar problem? If there were an MVCE, I could check this assumption and get back to you with an answer.
  • http://microsoft.public.vc.stl.narkive.com/S4mncifz/problem-compiling-template
    looks like this time it was something rather different, related to using const char * as a template argument (something I didn't know was possible!). They solved it by making their variable extern. Well, this looks totally different to the first issue… If only there were an MVCE so that I could quickly check if you had some kind of pointer in your template arguments, which might hint that this is the more likely issue.
    Interestingly: reveals that VC's equivalent error is "an expression involving objects with internal linkage cannot be used as a non-type"
  • https://software.intel.com/en-us/forums/intel-c-compiler/topic/514793
    wow, function pointers in templates now? I'm learning all kinds of things! OK so they're talking about a behaviour change going into C++11. Man, it'd be nice to know if you're pre- or post- C++11 - that could save me some time! Oh well. They link to a SO answer explaining the change, so let's look at that.
  • Why did C++03 require template parameters to have external linkage?
    oh hey, it's our very own Lightness Races in Orbit. There's a concrete example of potentially bad behaviour in the answer… From a cursory glance, it looks like there's an issue if you have an extern template (i.e. one we promise to define in another compilation unit) which, when defined, tries to use something which would be hidden from other compilation units (that the template isn't hidden from). Makes sense I guess. But it sounds like they spec'd it restrictively so that even non-extern templates get the same rules. I wonder if you're trying to do something like this? From the looks of the earlier bug report, it sounds like if you are, you might be in a twilight zone of some compiler's accepting it and others rejecting it! I'd love to help you out of a twilight zone, but I don't have a clue if it's anywhere near relevant to you.

Let's take a step back and search around Visual C++'s name for the error:

  • Passing a structure as a template-parameter - How can I fix this code?
    Oh OK. So this is yet another situation which is causing the same error. Now they're trying to pick a template using what they assume are const values (in this case: which have been passed through a struct first). Feels like the kind of thing constexpr was brought in to help with. Maybe you're trying to do something like this? It feels similar to using strings and function pointers…

I think I'm getting an idea of what the underlying error is now, since most of these have some themes in common. Let's see if I can explain it with any clarity:

You have tried to use a value which won't be available to other compilation units (a "non-external entity") as a template argument.

Hmm, that… actually sounds a lot like the message you're already seeing. Maybe if I knew exactly which part you're unclear on I could try to expand on it; I guess I explained roughly what a non-external entity is. And if your actual problem was closer to the first thing I found, you'll be absolutely no closer to fixing it. I should expand my answer:

Or you could trigger this if you mis-match function arguments when you instantiate your template.

Well that still doesn't cover the whole extern template stuff I saw. I should expand my answer:

Or you could trigger this if you try to use a static function in your template's code and you're pre-C++11.

But those are both way too specific for a guess-answer. I imagine I'm only scratching the surface of possible unrelated causes.

Oh also maybe you're dealing with the compiler twilight zone issue? I should expand my answer:

In C++11 the spec made a change to this behaviour which may have been slow to propagate to all compilers. For example, Intel's compiler will spuriously produce this warning when it shouldn't (see https://software.intel.com/en-us/forums/intel-c-compiler/topic/514793). If you're using such a compiler, you should upgrade or switch, or work around it somehow.

Dang, now I've given 4 separate explanations and solutions. 3 of them are super-specific to situations which probably don't apply to you, and the first hardly alters the message you're already seeing. This is a terrible answer.

Nevermind, guess I can't help you. Oh well, I would only have wasted those hours anyway.


TL;DR: Asking for a MVCE / SSCCE isn't just pedantry; it's genuinely required for diagnosing even seemingly generic abstract problems. If I don't have anything to check on / experiment with / test assumptions against, how can I know what information is most relevant? How can I know what you're trying to accomplish?

And if you think an error message is something concrete with a unique explanation, just take a look at the books written here: What is a NullPointerException, and how do I fix it?

8
  • 16
    I highly respect the amount of effort you put into this.
    – einpoklum
    Jun 16, 2016 at 22:47
  • 1
    And despite the volumes written in response to the NPE question, we regularly get people complaining that it doesn't answer their question. So arguably it could be expanded more. (Or people could just learn to help themselves, instead of expecting to be spoon-fed. But we all dream.) Jun 17, 2016 at 6:12
  • I googled the message end up on SO there stackoverflow.com/questions/3773378/…. The answer is quite short but some better explanations can be found in the comment
    – Walfrat
    Jun 17, 2016 at 6:59
  • @Walfrat that explanation would match the second link in my journey, or the first part of my proposed answer. Unfortunately it does not cover the other possible causes of this error (the second, third and fourth parts of my proposed answer), where the same message appears in entirely different (from the programmer's perspective) situations. If the question made it clear that it was using char* in templates, that would absolutely be the best answer. As it is, who can say?
    – Dave
    Jun 17, 2016 at 7:13
  • 5
    @einpoklum thank you. It's not an exaggeration that you got 2 hours of my time here (time which I should have spent sleeping!). I'd never normally put so much effort into an answer, especially when I have a good idea in advance that it will be too broad to post when I finish it, so I hope this gives you some insight into the commenter's mind when they insist on code samples.
    – Dave
    Jun 17, 2016 at 7:26
  • 4
    @einpoklum Does your respect for the effort mean you understand the need provide MCVE's in future?
    – Basic
    Jun 18, 2016 at 23:47
  • 5
    I'm of the opinion the OP should accept this answer. It's fantastic work. +1
    – jpmc26
    Jun 19, 2016 at 0:34
  • 2
    @Basic: Let's say I better understand the usefullness of illustrating a general question with an MCVE, and next time I'll make more of an effort to produce one even for questions not specific to my experience. I don't think my question was "Too broad" though; you still assume I wanted to know why I got this message, while I wanted to know when the compiler_authors issue this message.
    – einpoklum
    Jun 19, 2016 at 7:57
8

With C++ compiler and it's messages, it's just moot. The message is plain text, and explaining it without the surrounding code simply means quoting the message. In your case, answer to question I just don't understand what this message means. is:

This message means that non-external entity can not be used as template argument.

Any better? To get the real answer, the question would be something like

What do external and non-external entities mean in C++ in template instantiation context?

3
  • 3
    But that's almost what I asked. And if I had asked exactly that, I suspect people would have told me "that depends on the context" or "what problem are you trying to solve" etc.
    – einpoklum
    Jun 16, 2016 at 21:02
  • 3
    That's exactly why it's a good idea to provide a code sample, showing what problem you're trying to solve.
    – alexis
    Jun 17, 2016 at 16:20
  • 1
    @einpoklum When people say something depends on the context, that's because it depends on the context. ;) So they want the context. Otherwise, they'll end up writing a book trying to detail all the possible contexts, which SO's rules actively discourage.
    – jpmc26
    Jun 19, 2016 at 7:42
4

TL;DR

People are trying to help you. Help them help you - and you will benefit from it.


I agree with existing answers, but let me show another perspective of this. Suppose you ask this question:

What does the obscure error message "blah blah" mean?

Here, you are looking for people who will say

Oh, that message! I have seen it just yesterday, and I know exactly what it means.

That is, like 10% of people? 1% of people? What will the rest 90% think?

Seems like an obscure error message. If I saw the code, I could try playing around with it and deduce the meaning of the message.

So, you just reduced the number of people who try to answer your question by a factor of 10 (just a guess). Not a good strategy for getting an answer to your question!


Also, there is the annoying feeling that you withhold information - don't provide it when politely asked - maybe for a good reason (or maybe not), but it is annoying anyway. Also, not a good strategy if you want answers.


In the light of the above:

If you think people want you to provide irrelevant information, the constructive course of action is to:

  1. Provide the information
  2. Explain why it is irrelevant

    • If you are wrong (happens to the best of us) - you improved your post
    • If you are right - at least the people that demand the information will shut up
3
  • Well, I tried option #2. What happened was that, on one hand, I started getting useful information in the comments; but on the other hand, I was "flooded" with downvotes, and upvotes for the "post code!" comment.
    – einpoklum
    Jun 16, 2016 at 22:49
  • Also, see my answer to the linked-to question. Someone could very well have given that as a one-liner "Well, blah means yada yada blah blah, and that you can easily look up."
    – einpoklum
    Jun 16, 2016 at 22:51
  • 3
    I meant to say "do both". Used the wrong style - fixed now.
    – anatolyg
    Jun 16, 2016 at 22:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .