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

Recommended Answers

All 3 Replies

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

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

EDIT: nvm.......

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.