C++ Programming Tutorial 15 undefined reference to 'Burrito :: Burrito()'

+1 Guyman Lam · May 1, 2015

Post a Reply


Oldest  Newest  Rating
+1 Matthew Cushing · May 1, 2015
Since you are using different files for your headers and your headers constructors and functions (like you should) then you realized that you had to declare <iostream> in Burritos cpp file because you are using cout. You also have to declare 
using namespace std;

if you aren't going to do this
0 Matthew Cushing · May 2, 2015
Wish you could edit posts here >. <

Saw that you are using namespace. I'll have to take a look at the code on my compiler when I get home from work to give you a proper solution
0 Matthew Cushing · May 2, 2015
Alright, so syntax-wise there is absolutely nothing wrong with your code.  This has everything to do with the compiler and them being separate files(which is the correct way to do it but your function is not being found by the linker).  Personally, I use Visual Studio so I am unsure on where CodeBlocks stores each of its files and how it stores each of its files.  This probably has something to do with your first screenshot and where it's storing those files in that folder on your desktop or any of the other options.  I would personally just make sure that all your settings in that class creation wizard are identical to Bucky's (although I'm sure you already have) and if you still can't figure it out then either reinstall the compiler and use it's default paths or install a different compiler.  I personally prefer Visual Studio, it's interface and tools are extremely organized and powerful.  I've never personally had a wizard create a class and its files for me but rather manually created them myself since it's as simple as creating a .cpp file except naming it .h

Hope you figure it out
0 Maciej Gozdek · May 2, 2015
I'm also using Visual Studio (Community edition – which is exactly the same as Professional version but free for individuals and companies who have up to 5 programmers) so I can't say what the problem is as your code is correct and it runs perfectly in VS.

The only thing I can think of is that you might have your files in different directories.
  • 1



Used in many types of software including music players, video games, and many large scale applications.

Bucky Roberts Administrator