Hey I'm having trouble with compiling this code, I keep getting a "undefined refernce to winmain@16
I feel like it has to do with int main() I tried just main(), im not sure how to fix that

#include <iostream>
#include <fstream>
#include <string>
#include <stdio.h>
#include "HangmanBoard.h"
#include "FileProcessor.h"

using namespace std;

class Hangman{



	int main(){

		int right;
		bool isGuesser = false;
		bool isOpp = false;
		string gotWord;
		int wordSize;
		char input;
		string libraryLocation;
		char* guesser;
		char* opp;
		char guessedLetter [80];
		int wrong = 0;
		int gcount = 0;
		char* words[1000];
		int wrdcnt;
		bool gameover = false;

		intro();
		printf("Enter Library");
		cin >> libraryLocation;
		//scanf("%s", libraryLocation);
		openWordFile(libraryLocation);

		printf("Enter the word from the word bank");
        cin >> libraryLocation;

		//scanf("%s",gotWord);


		printf("Who is the guesser?");
		scanf(guesser);
		if(guesser[0] == 'h'){
			isGuesser = true;
		}
		else {
			isGuesser = false;
		}

		wordSize = gotWord.size();
		char* arrayWord = new char [wordSize];
		for(int i=0; i < sizeof(arrayWord); i++){
			arrayWord[i] = gotWord[i];
		}


		bool cover [wordSize];
		for(int i = 0; i < sizeof(cover);i++){
			cover[i] = false;
		}

		char* pguess = new char [wordSize + 6];


		while(isGuesser == true){
			while(gameover == false)
				{
				printf("Please enter the letter that you would like");
				while(1){

					fflush(stdin);
					scanf("%c",&input);
					if(!(isalpha(input))){
						cout<< "Invalid entry please re-enter";
						continue;
					}

				}//end while(1)
				right = 0;;
				gcount++;
				pguess[gcount] = input;

				for(int i = 0; i < wordSize; i++){
					if(arrayWord[i]==input){
						right++;
						cover[i] = true;
					}
				}
				if(right == 0){
					wrong++;
				}
				image(wrong);
				display(cover, arrayWord);
				pastguess(pguess);
				if(right == 0){
					cout << "Sorry try again";
				}
				else{
					cout << "Good guess";
				}
				gameover = checkWin(cover);
				if (checkWin(cover) == true){
					cout<< "Congrats,guesser won";
				}
				gameover = checkLoss(wrong);
				if (checkLoss(wrong) == true){
					cout << "Guess Losses";
				}
				}//end gameover whi8le
			}//end guesser while
	}//end main
};



//end class;

You've chosen the wrong kind of project. Choose "Win32 Console Application" instead of Win32 Application.

This is an error you receive when your compiler can't find the entry point to your code.

Your main function cannot be inside a class. How will you access it inside a class? What will call it? You need your main function to be immediately accessible so your program can start!

Good catch, Red Goose. I think it's both things, then (if it's looking for WinMain instead of main, the project type is incorrect, but once the OP fixes the project type it's still not going to be able to find main() proper either).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.