944,172 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 9283
  • C++ RSS
Mar 30th, 2005
0

error LNK2001: unresolved external symbol

Expand Post »
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.


C++ Syntax (Toggle Plain Text)
  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 >>
Reputation Points: 10
Solved Threads: 0
Newbie Poster
rpgplyrff8 is offline Offline
4 posts
since Jan 2005
Mar 30th, 2005
0

Re: error LNK2001: unresolved external symbol

Make sure your function's prototype matches its definition.
int s (void)
Team Colleague
Reputation Points: 2780
Solved Threads: 312
long time no c
Dave Sinkula is offline Offline
4,790 posts
since Apr 2004

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: another oop error cant solve :(
Next Thread in C++ Forum Timeline: parsing date strings mm/dd/yy??





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


Follow us on Twitter


© 2011 DaniWeb® LLC