Hi, I am rusty and I am trying to do exercises using C++ again. I have separate .cpp, header and main as shown below. Can you kindly help me fix this error that I keep getting. I am using Visual Studio Community. Thank you.
Error:
LNK201 unresolved external symbol WinMain referenced in function
"int_cecl invoke_main(void)"
//this is the main.cpp file
#include "exercise1.h"
#include <iostream>
#include <string>
usingnamespace std;
int main()
{
Play obj;
obj.printing();
};
//this is the .cpp (exercise1.cpp):
#include "exercise1.h"
usingnamespace std;
void Play::PLay()
{
}
int Play::printing()
{
return 1;
};
//This is the header (exercise1.h):
#ifndef PLAY_H
#define PLAY_H
class Play
{
private:
public:
void PLay();
int printing();
};
#endif
Hello. When I am reading an exercise like this, I could burn the book :/
I understand that it is not always easy for a beginner to "split" a code in multiple file parts with an header file and its declarations - and cpp files out of the main process with some definitions, but what you showed today is just bad...
Nothing is optimized - no constructors with direct parameters, no private members, an included header for nothing...
Respectfully are you sure that you walk on the right way. I know many more interesting tutorials if you want?