error LNK2001: unresolved external symbol

Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jan 2005
Posts: 4
Reputation: rpgplyrff8 is an unknown quantity at this point 
Solved Threads: 0
rpgplyrff8 rpgplyrff8 is offline Offline
Newbie Poster

error LNK2001: unresolved external symbol

 
0
  #1
Mar 30th, 2005
I have been working on this project for my C++ class that I am taking and Ive gotten an error message I have never seen before. When I am attempting to execute it i get the flowing error:

error LNK2001: unresolved external symbol "int __cdecl s(void)" (?s@@YAHXZ)

I have also posted my code following this. I would appreicate any help that is offered because I have no clue what is going on.


  1. // Chapter 4 Project 20
  2. // By William Creech
  3.  
  4. #include <iostream>
  5. using namespace std;
  6.  
  7. int s (void);
  8. int economy (void);
  9.  
  10. const int a = 10;
  11. int aray [a] = {0};
  12.  
  13. int main ()
  14. {
  15. int cont = 0;
  16. int c = 0;
  17.  
  18. while (cont =! -1)
  19. cout << "Welcome to Creech Airlines. Please enter \n 1 for 1st class \n 2 for Economy" << endl;
  20. cin >> c;
  21.  
  22. switch (c)
  23. {
  24. case 1:
  25. s ();
  26. break;
  27. case 2:
  28. economy ();
  29. break;
  30. default:
  31. cout << "Incorrect selection please enter the number again." << endl;
  32. cin >> c;
  33. break;
  34. }
  35. cout << "Are their more people in line?(enter -1 to end)" << endl;
  36. cin >> cont;
  37.  
  38. return 0;
  39.  
  40. }
  41.  
  42. int s (int)
  43. {
  44.  
  45. int x = 0;
  46.  
  47.  
  48.  
  49. if ( aray [0] == 0)
  50. {
  51. aray [ 0 ] = 1;
  52. cout << "You are sitting in 1st class seat one. Thank you, your flight will be leaving shortly." << endl;
  53. }
  54. else if ( aray [0] != 0)
  55. {
  56. aray [1] = 1;
  57. cout<< "You are sitting in 1st class seat two. Thank you, your flight will be leaving shortly." << endl;
  58. }
  59. else if (aray [1] != 0)
  60. {
  61. aray [2] = 1;
  62. cout << "You are sitting in 1st class seat three. Thank you, your flight will be leaving shortly." << endl;
  63. }
  64. else if (aray [2] != 0)
  65. {
  66. aray[3] = 1;
  67. cout << "You are sitting in 1st class seat four. Thank you, your flight will be leaving shortly." << endl;
  68. }
  69. else if (aray [3] != 0)
  70. {
  71. aray [4] = 1;
  72. cout << "You are sitting in 1st class seat five. Thank you, your flight will be leaving shortly." << endl;
  73. }
  74. else
  75. {
  76. cout << "There are no more 1st class seats available. Is it ok to put you in economy class? (Press 1 for ok 2 for no)" << endl;
  77. cin >> x;
  78. }
  79. if ( x == 1)
  80. economy();
  81. else
  82. cout<< "The next flight will leave in three hours." << endl;
  83.  
  84.  
  85. return 0;
  86. }
  87.  
  88. int economy ()
  89. {
  90.  
  91. int y = 0;
  92.  
  93. if ( aray [5] == 0 )
  94. {
  95. aray [ 5 ] = 1;
  96. cout << "You are sitting in Economy class class seat one. Thank you, your flight will be leaving shortly." << endl;
  97. }
  98. else if ( aray [5] != 0)
  99. {
  100. aray [6] = 1;
  101. cout<< "You are sitting in Economy class seat two. Thank you, your flight will be leaving shortly." << endl;
  102. }
  103. else if (aray [6] != 0)
  104. {
  105. aray [7] = 1;
  106. cout << "You are sitting in Economy class seat three. Thank you, your flight will be leaving shortly." << endl;
  107. }
  108. else if (aray [7] != 0)
  109. {
  110. aray[8] = 1;
  111. cout << "You are sitting in Economy class seat four. Thank you, your flight will be leaving shortly." << endl;
  112. }
  113. else if (aray [8] != 0)
  114. {
  115. aray [9] = 1;
  116. cout << "You are sitting in 1st class seat five. Thank you, your flight will be leaving shortly." << endl;
  117. }
  118. else
  119. {
  120. cout << "There are no more Economy class seats available. Is it ok to put you in 1st class class? (Press 1 for ok 2 for no)" << endl;
  121. cin >> y;
  122. }
  123. if ( y == 1)
  124. s();
  125. else
  126. cout<< "The next flight will leave in three hours." << endl;
  127.  
  128. return 0;
  129. }

<< moderator edit: added [code][/code] tags >>
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,461
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 254
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: error LNK2001: unresolved external symbol

 
0
  #2
Mar 30th, 2005
Make sure your function's prototype matches its definition.
int s (void)
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 6753 | Replies: 1
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC