Just starting out, please help.

0 Darius Spates · July 11, 2015
Hi how's it going (to whomever reads this), I'm just starting to learn programming, and I decided to start off with the C++ language.  I was following Bucky's youtube tutorials when I ran into a problem, and now I'm not sure what to do about it.
Here's my issue,

Error-


undefined reference to 'Print :: Print( )'


Code Below-

main.cpp-

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

using namespace std;

int main()
{
    Print PO;
    return 0;
}


Print.h-

#ifndef PRINT_H
#define PRINT_H


class Print
{
    public:
        Print( );
};

#endif // PRINT_H


Print.cpp-

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


using namespace std;

Print :: Print( )
{
    cout << "YES, YES, YES, I CAN WIN, I FEEL GREAT, I...CAN...DO...THIS!"
}

Seemed fairly straight forward, but it's just not working for me, please help if possible.

Post a Reply

Replies

Oldest  Newest  Rating
0 Jasmin Bakalović · July 11, 2015
I see only one mistake and that mistake is the end of the statement.

File: Print.cpp
Line: 9
Error: Missing semicolon
0 Michael Bradford · July 11, 2015
Did you make sure that you made a project file via codeblocks or w/e compiler your using? You can get linker problems without creating a project and since your error is complaining about an undefined function it's probably because it can't see the definition which is in your implementation file, which (if there is a linker error) won't have been connected to your header file.

basically a compiler linker will link the whatever.h(header) file to the whatever.cpp (implementation) file so that it can see that yes the constructor Print() is prototyped in the header and I can find the definition of that prototype in the implementation file. But if the link isn't established it goes yes the constructor Print() is prototyped in the header... where is it defined though I don't see an implementation file.. ERROR.
  • 1

C++

106,930 followers
About

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

Links
Moderators
Bucky Roberts Administrator