C++

+1 Robert Summers · August 3, 2014
Error displaying: Returning a value from constructor.

I am following Buckys 15th tutorial in Buckys C++ Programming Tutorials, Placing Classes in Separate Files. 
Please Help, thanks in return. 

main.cpp
#include <iostream>
#include "Burrito.h"
using namespace std;

int main()
{
    Burrito ro;
    return 0;
}


Burrito.h


#ifndef BURRITO_H
#define BURRITO_H


class Burrito
{
    public:
        Burrito();

};

#endif // BURRITO_H


Burrito.cpp

#include "Burrito.h"
#include <iostream>

using namespace std;

Burrito::Burrito()
{
    cout << "i am a orange" << endl;
}


Post a Reply

Replies

Oldest  Newest  Rating
0 Mathias Frits Rørvik · August 3, 2014
It's the constructor, it doesn't need a return type.
0 waliul hasnat · August 3, 2014
you should declare a return type when you are declaring the member function in the class and then write the same return type like this:   type Burrito::Burrito()
0 Mathias Frits Rørvik · August 3, 2014
Better off using just Visual Studio Express, people get this problem all the time with Codeblocks.
0 Adam Beck · August 3, 2014
I don't know what your problem is for this video, but I had a problem and this was the solution that fixed it:

 

For everyone using CodeBlocks and are getting "undefined reference" errors, do this:


Go to the left panel that says projects, and right-click on yourProject.cpp file. Select properties, then go to build. Check the boxes under the heading Belongs in Targets: "Debug" and "Release"?
  • 1

C++

107,108 followers
About

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

Links
Moderators
Bucky Roberts Administrator