Can't find what is causing an error by googling error code.

Hello,
i can rarely find, what is causing the error, by googling error code. It usually stands for generic issue. And microsoft docs are not much helpful either, if i don't know programming that well, i will not understand that anyway, or it is about different issue. Otherwise google finds some posts on stackoverflow, which are usually about a completely different issue and code, but have same error code. Even if i add words from my code, or what i am doing, still nada.

It helps to know syntax, or semantics etc. But if you just learning you won't know everything, so this get you only so far. Even if i know concept and i checked even syntax and it was same, than i don't know why this issue has arisen. Than i need google error code, but it finds nothing...

I am learning from bjarne stroustrup book and there are no solutions, so i need to use google. I read even whole sections for debugging on this site: https://www.learncpp.com/
And it is more about tactics to find: what is causing the issue and disable sections of the code. But there wasn't a word about error codes. Even creator of c++ says that, 90% of time you will be troubleshooting error codes, so fun... Besides google can't even find it...

Last edited on
Do you have a question?
That's for what the forums like this or stack overflow are. If you don't can figure out what your compiler claims and you don't find the subject with your favorite search engine, the only option is mostly posting your code, together with the error messages, to a forum.
I'm also a self-taught programmer, and for a long time, I found it hard to interpret the error messages of the compiler. But with time I got more and more experience so I can now interpret almost all error messages.
It's an enormous task for the compiler, handling all code with its templated stuff to process. and I admire what the compiler coders made possible. So I could imagine how hard it is, providing matching error messages to some erroneous code. And when I sometimes have difficulty interpreting an error message, I recall to me the fact that: "The compiler is our friend!"
Hello empleat,

The answer to your post is 42.

https://www.youtube.com/watch?v=aboZctrHfK8
https://www.dictionary.com/e/slang/42/

In addition to what nuderobmonkey you may want to read or reread http://www.cplusplus.com/forum/beginner/1/

That said let everyone what IDE you are using. It helps.

Post the complete error message. Not what you think it means.

Post the offending code that can be looked at and compiled. It helps to duplicate your problem.

AS an example I once worked on a program that showed an error on line 50, but the error tarted on line 40. It took 10 lines to show up.

You also made a reference to Stroustrup's book. What page is the program on? What chapter? It is a big book do not expect others to guess at what you are working on.

If you would like an answer give others something to work with. Do not expect them to guess at the problem.

Andy
I am using visual studio 2019 community. It was just trivial program. I checked syntax and it was correct and simple. So i have no idea why it didn't work. I was looking more for an advice how to find what error codes mean. I can't post each time when i don't know something on stackoverflow, takes too long. And since you will be 90% of time solving errors. I couldn't do anything else...

There wasn't answer, which i find stupid, since it is hard to troubleshoot problem using error codes. There is no point wasting readers time, to find why it didn't work in case of such a trivial program. That's rather skill you want to develop later on looking on program and finding why it didn't work.

But if you say, it is not possible to find error using error codes. So i will just skip that and go learn something else and hopefully, i learn that at some point why it didn't work.
Last edited on
empleat wrote:
I am using visual studio 2019 community. It was just trivial program. I checked syntax and it was correct and simple. So i have no idea why it didn't work.


So:-
- post your code
- post your error messages

Otherwise, there is little point in using a forum just to let off steam. As @Andy has effectively already said, we aren't psychics.
It was just trivial program. I checked syntax and it was correct and simple.
The first step is to believe the compiler. If it tells you there's an error then the program is NOT correct.

I know this sounds insulting, but it isn't meant to be. Trust me, if you don't believe there is an error then you'll never find it.

As for techniques, here are three important ones:

1. Start with the first error that appears. Sometimes one error throws off the parser so that it complains about code that's actually okay once the first error is fixed.
2. Read the error message carefully. Don't just think "oh hell, there's an error." The message is trying to tell you what's wrong.
3. The actually error might be before the place where the compiler thinks, but it's rarely after. So if the line indicated seems okay then look at the lines before it too.

As others have said, post the code and the error message here. People here are generally very helpful.
Ill add a little to the above.
1) can't stress enough #1. Ive seen a missing ; generate over 2 pages of errors on a very small program that sound like you may as well just start over, all hope is lost, this stuff is too broken to carry on. Fix the ; and the whole mess clears out and the program runs.

2) Practice. Read the error. Ask questions. Save the error text for reference! But this is critical: once you get your problem fixed, go back to your error text, and NOW try to understand what it was telling you now that you KNOW what it was telling you. Can you make sense of what it was trying to say? Reading error messages takes a while. Once you 'get' it, you begin to understand the terms and language the compiler uses to express the problems, you will be able to understand the error messages better and better which will make fixing the problems much, much easier.

3) I use a somewhat second-tier compiler and even with that, I don't think I have seen more than 2 or 3 major bugs over several decades. So yes, trust the compiler. Every bug I "found" was already well known and in at least one of the cases repaired by getting the latest version.
Another big thing to remember is to compile early, and often.

Start with something simple, for example:

1
2
3
4
5
6
#include <iostream>

int main()
{
    std::cout << "Hello world!\n";
}


Compile and run the program, since it is a very small program if there is an error the compiler should direct you right to the line where the error is located. And you need to be sure to thoroughly read the error message, looking for key works like "missing", "before". And make sure that each opening brace or parentheses have closing braces or parentheses and that you have properly terminated each statement with a semicolon.

Once you have the basic program working start adding your program's logic, compiling often (many times after as little as one line). Always fix all warnings and errors as they appear never ignore warnings.

And by the way Microsoft warnings and errors have very good documentation (on MSDN) searching for the warning/error number will usually lead you to the documentation for that problem. But you will need to learn to understand many of the concepts, this is were practice comes into play. The more times you come across the same error the easier it will be to understand what the error message and documentation is talking about.

Also when it comes to using standard functions searching for the function/method will also be a good idea (ie search for std::cout) and you will find lot of possibilities.


By the way depending on the book there may be "solutions" to some of the exercises available on the website dedicated to the book.


Microsoft toolchain. Be thankful of those codes that the tools spit out.

You can go to https://docs.microsoft.com/en-us/cpp/error-messages/
and fine some amount of explanation about each error code.

Imagine that the compiler would spit out all that text for each error and warning.

Other compilers might not have as searchable identifiers for errors nor longer descriptions anywhere.


I've heard of a "tiny error" (in templated code) that made the compiler spit out 1000+ lines. Even for experienced reader there was a challenge to spot the genuine error description.
Hello empleat,

Before posting code:

PLEASE ALWAYS USE CODE TAGS (the <> formatting button), to the right of this box, when posting code.

Along with the proper indenting it makes it easier to read your code and also easier to respond to your post.

http://www.cplusplus.com/articles/jEywvCM9/
http://www.cplusplus.com/articles/z13hAqkS/

Hint: You can edit your post, highlight your code and press the <> formatting button.
You can use the preview button at the bottom to see how it looks.

I found the second link to be the most help.


Very helpful to read the two links above.

After pressing the "reply" button, in the already running thread, and starting your message. Start your message and use the code tags when posting the code.

Start of post.

[code]
  //  Your code between the tags.
[/code]
Continue here or all a blank line.



Until you can post your code it is a matter of guessing at what to say.

Hope that helps,

Andy
I usually consult and order from this website: https://www.dutchpapers.com

LOL, I'll bet you do Lily. trouble is your masters graduates got there degrees via the same system.
Last edited on
@againtry, That's a technique spammers use to post an ad. The proper response is to "Report" it, which will remove the post (note how it's gone now). You've done the worst thing by reposting the ad!
@dutch You're right it's spam, Lily is a very unusual Chinese name (not).

As far as reporting is concerned my understanding is if that was the first post of the thread then it would be removed automatically. After that all that can be done is report it.

Maybe I'm wrong - there's always room in anybody's life a first time.

In the meantime I have written a program to print out 1650 times "I must not do worst stuff." :)
Yes, this is the first time you've ever been wrong. :)
It will in fact remove the post even if it's not the first in the thread.
As I said, the post is gone.
It seems to depend on the number of posts they have made (under 10?).
You might want to remove the link from your previous post. Spammer!
Maybe change it to stupidpapers?
All good. Now back to typing in those lines in my cout statement. I heard about loops but nobody has taught me how they work.
Topic archived. No new replies allowed.