Variable Scope and Parameters help

I have no idea why this simple code not working.... help please

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
using namespace std;

void doOneSet(int, int);

int mian() {
	int First, Second;
	First = rand() % 101;
	Second = rand() % 101;
	doOneSet(First,Second);

	system("pause");
	return 0;
}

void doOneSet(int X, int Y) {
	int i;
	for (i = 0; i < 5; i++) {
		cout << X << " + " << Y << " = " << endl;
	}
}
Last edited on
So what is this function?
int mian() {}

???
Why haven't you responded? Is this problem solved now?
1. spell main right:
1) You have system("pause"); without the necessary library to execute the statement.

Add #include <stdlib.h>

2) Your other error says "undefined reference to WinMain@16 C++"

From what I know, there are a handful of ways to fix this. You can copy your code and paste it in a new project (meaning a complete restart may fix it).

You can go to project, build option, and mark...
http://i.stack.imgur.com/BoXJZ.png

You can also go to project, build option, linker settings tab, link libraries, click add, write this "mingw32;libSDL.a;libSDLmain.a" (without the quotation marks), go to "Search directories" --> "Linker", and add MinGW.

Hopefully that helped.
@FBHSIE

std::system is in #include <cstdlib>

Prefer to use the C++ header rather than the C one.
Topic archived. No new replies allowed.