944,123 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 414
  • C++ RSS
Nov 2nd, 2009
0

Error message "Linker error"????

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 1
Junior Poster in Training
discovery-power is offline Offline
94 posts
since Oct 2009
Nov 2nd, 2009
-7
Re: Error message "Linker error"????
You created a windows gui project, not a windows console project. Start again, but this time create the right kind of project.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2283
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,961 posts
since Aug 2005
Nov 3rd, 2009
0

how did i do it??

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
Reputation Points: 10
Solved Threads: 1
Junior Poster in Training
discovery-power is offline Offline
94 posts
since Oct 2009
Nov 3rd, 2009
0
Re: Error message "Linker error"????
EDIT: nvm.......
Last edited by Fbody; Nov 3rd, 2009 at 2:32 pm.
Featured Poster
Reputation Points: 833
Solved Threads: 392
Posting Maven
Fbody is offline Offline
2,846 posts
since Oct 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: hash table /independent rehaching
Next Thread in C++ Forum Timeline: Need help with FOR repitition with Switch





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC