The bleep project in the object section

Here is the source code,
Just can’t figure it out, and can’t understand the error report after compiling.

Your functions are declared as

std::string subs(...);
std::string bleep(...);

but they don’t return any string.

This will result in an error. If you want to not return anything, then you should have a void function, but if you do want to return something, you need to state it at the end of your functions.

I’ve noticed that, but still the same error after debug.

Well, then it’s just a different error then. :slight_smile: That’s at least one less error.

C++ is very unforgiving in terms of error messages at compile time, what are you doing to debug? @zedlukas There isn’t that much code here, so I feel it’s more useful to work out some methodology.

I am not sure what to do, just compare the standard code given on the github with mine. Holy ***! I got a sore eyes already.

For example, I’d start from the end of your code and work backwards, adding simple test features.

I’d comment out the bleep function invocation in the main first.

  • if this removes the error, the issue is related with the function
  • if this doesn’t remove the error, the issue could still be related with the function, but could also be related to the linking of files.

And these two things branch out:
If it is function related:

  • make a test function (void hello_world()), if this can be run, then it’s a problem inside the function bleep.
  • if it doesn’t run, it could still be an issue inside bleep, but additionally could be an issue with how the function is declared…


It helps to be thorough. I like to keep track in a notebook of all the debugging thoughts because as you program more a lot of ideas keep recurring. The more organized it is, the more efficient you become over time.

Thanks very much, I think I just solved the problem somehow. Actually, I think debug is another course to learn, lol!

1 Like

Debugging is a world unto itself :slight_smile:

For cpp and other difficult languages it’s a worthwhile skill to build!

1 Like