0

Hi All,

I am trying to write a small program to better understand and practise writing blocks of code, I have written the one below but get the error message :

"Linker Error undefined reference to WinMain@16
ld returned 1 exit status"

// This program demonstrates a block of code

#include <iostream>
using namespace std;

int main() {
double result, n, d;

cout << "Enter Value: ";
cin >> d;

// The target of this is the entire block.

if(d != 0) {
cout << "d does not equal zero so division is OK" << "\n";
result = n / d;
cout << n << " / " << d << " is " << result;
}

cin.ignore(1024, '\n');
cin.get();

return 0;

}

can anyone tell me where I am going wrong.

Thanks

John

3
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by Fbody
0

You created a windows gui project, not a windows console project. Start again, but this time create the right kind of project.

Thanks for the reply and this is going to sound like a daft question, but can you tell me which line of code made it a windows gui, because I just opened a new source project and entered the entire program myself, I didnt go to the open new project options and choose windows gui or console.

Thanks very much for your help.

John

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.