Game Test

There is an error that says "undefined reference to WinMain@16. What does this mean? If anyone can find any more errors to fix plz help!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
 
// game test number 1
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <stdio.h>
#include <string.h>
using namespace std;

int dialouge1(){
    
    cout << "You have been assigned by the Lord of Uberdark to patrol the Mines of Rodin. While patroling you run into a goblin!";}
int Fight1(){
int d10 ;
int ML1 ;
int rr ;
    char myArray[50];
    cout << " What do you want to do, run or fight the goblin? ";
    cin.getline( myArray, 50, '\n');
    if( !strcmp( myArray, "fight")){
        srand(time(0));
    d10 = rand() % 10+1;
    cout << d10;
    ML1 = rand() % 10+1;
    cout << ML1;
    if(d10 > ML1){
    cout << " You defeated the goblin!" << endl << endl;}
    if(d10 < ML1){
    cout << " You have been defeated by the goblin! You retreat back to Uberdark to rest." << endl << endl;}
    if(d10 == ML1){
    cout << " You and the goblin have both been defeated by entropy!\n\n";
    }
    if(d10 == ML1){
           cout << " You get back up and rest for a while to then continue your task.";}
    if(d10 < ML1){
           cout << " You return from Uberdark well rested.";}
           }
    if( !strcmp( myArray, "run")){
        srand(time(0));
        rr = rand() % 14+1;
        if(rr > 7){
              cout << " You have successfully ran away, coward!";}
        if(rr < 7){
              cout << " The goblin has caught up to you and beat you to the floor. You wake up later and continue to patrol.";}
              }
system("pause");
}
Last edited on
Did you perhaps forget to define a main() function?
First, your problem (as maeriden said) is that you are not defining a main() (or WinMain()) function for your program. This means that your linker does not know where the main entry point for the program is.

Another little thing, (though it might not be an error) is that if you declare a function as an int your program expects it to return an interger. For things like dialouge1(), you should probably define it is a void function. The same goes for your Fight1().
Also, WinMain belongs in a windows application. An ordinary console application has main. Most likely the wrong project type was selected at the start. I'd suggest starting a fresh project and choosing "console" as the project type.
Topic archived. No new replies allowed.