,   CyberForum.ru

[Linked Error] Unresolved External - C++

 
Rifle
   Rifle
25 / 25 / 5
: 15.11.2012
: 93
: 4
15.11.2012, 13:09     [Linked Error] Unresolved External #1
, !

++ , , . .
. SendMessage ( ), - . , :
C++
1
[Linker Error] Unresolved external 'Airplane::SendMessageA(int, char *, int, int, int)' referenced from C:\USERS\JESUS\DESKTOP\PROJECTS\DISPETCHER\AIRPORT.OBJ
, - ; , - .
, ? - . , .
, .
* : , Airplane::SendMessageA, "" . - ?

.

:
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#include <iostream.h>
#include <stdio.h>
#include "airplane.h"
#pragma hdrstop
//---------------------------------------------------------------------------
 
Airplane::Airplane(const char* _name, int _type) :
  type(_type),
  status(ONRAMP),
  speed(0),
  altitude(0),
  heading(0)
{
  switch (type) {
    case AIRLINER : ceiling = 35000; break;
    case COMMUTER : ceiling = 20000; break;
    case PRIVATE  : ceiling = 8000;
  }
  name = new char[50];
    strcpy(name, _name);
}
//
//Äåñòðóêòîð âûïîë*ÿåò î÷èñòêó ï*ìÿòè
//
Airplane::~Airplane()
{
  delete[] name;
}
//
//Ïðèåì ñîîáùå*èÿ îò ïîëüçîâ*òåëÿ
//
bool
Airplane::SendMessage(int msg, char* response,
  int spd, int dir, int alt)
//
//Ïðîâåðê* ïð*âèëü*îñòè ââîä*
//
  {
  if (spd > 500) {
    strcpy(response, "Speed cannot be more than 500.");
    return false;
  }
  if (dir > 360) {
    strcpy(response, "Heading cannot be over 360 degrees.");
    return false;
  }
  if (alt < 100 && alt !=-1) {
    strcpy(response, "I'd crash, bonehead!");
    return false;
  }
  if (alt > ceiling) {
    strcpy(response, "I can't go that high.");
    return false;
  }
  //
  //Âûïîë*å*èå äåéñòâèé â ç*âèñèìîñòè îò ïîëó÷å**îé êîì**äû
  //
  switch (msg) {
    case MSG_TAKEOFF : {
      //Âçëåò *åâîçìîæå*, ñ*ìîëåò óæå â âîçäóõå!
      if (status != ONRAMP) {
        strcpy(response, "I'm already in the air!");
        return false;
      }
      TakeOff(dir);
      break;
    }
    case MSG_CHANGE : {
      //Í* çåìëå èçìå*å*èå *åâîçìîæ*î
      if (status == ONRAMP) {
        strcpy(response, "I'm on the ground");
        return false;
      }
      //Èçìå*å*èå òîëüêî ïðè ïåðåä*÷å *åîòðèö*òåëü*îãî ç**÷å*èÿ
      if (spd != -1) speed = spd;
      if (dir != -1) heading = dir;
      if (alt != -1) altitude = alt;
      status == CRUISING;
      break;
    }
    case MSG_LAND : {
      if (status == ONRAMP) {
        strcpy(response, "I'm already on the ground.");
        return false;
      }
      Land();
      break;
    }
    case MSG_REPORT : ReportStatus();
  }
  //
  //Ñò**ä*ðò*ûé îòêëèê, åñëè âñå â ïîðÿäêå
  //
  strcpy(response, "Roger.");
  return true;
}
//
//Âûïîë*å*èå âçëåò*
//
void
Airplane::TakeOff(int dir)
{
  heading = dir;
  status = TAKINGOFF;
}
//
//Âûïîë*å*èå ïîñ*äêè
//
void
Airplane::Land()
{
  speed = heading = altitude = 0;
  status == ONRAMP;
}
//
//Ñîçä**èå ñòðîêè ñîñòîÿ*èÿ ñ*ìîëåò*
//
int
Airplane::GetStatus(char* statusString)
{
  sprintf(statusString, "%s, Altitude: %d, Heading: %d, "
     "Speed: %d\n", name, altitude, heading, speed);
  return status;
}
//
//Ïîëó÷å*èÿ ñòðîêè ñîñòîÿ*èÿ è âûâîä åå ** ýêð**
//
void
Airplane::ReportStatus()
{
  char buff[100];
  GetStatus(buff);
  cout << endl << buff << endl;
}
:
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//-------------------------
#ifndef airplaneH
#define airplaneH
#define AIRLINER     0
#define  COMMUTER    1
#define  PRIVATE     2
#define  TAKINGOFF   0
#define  CRUISING    1
#define LANDING      3
#define ONRAMP       3
#define  MSG_CHANGE  0
#define  MSG_TAKEOFF 1
#define  MSG_LAND    2
#define  MSG_REPORT  3
class Airplane {
  public:
    Airplane(const char* _name, int _type = AIRLINER);
    ~Airplane();
    virtual int GetStatus(char* statusString);
    int GetStatus()
    {
      return status;
    }
    int Speed()
    {
      return speed;
    }
    int Heading()
    {
      return heading;
    }
    int Altitude()
    {
      return altitude;
    }
    void ReportStatus();
    bool SendMessage(int msg, char* response,
      int spd = -1, int dir = -1, int alt = -1);
    char* name;
  protected:
    virtual void TakeOff(int dir);
    virtual void Land();
  private:
    int speed;
    int altitude;
    int heading;
    int status;
    int type;
    int ceiling;
  };
  #endif
:
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
 //---------------------------------------------------------------------------
#include <vcl\condefs.h>
#include <iostream.h>
#include <conio.h>
#pragma hdrstop
#include "airplane.h"
USERES("airport.res");
USEUNIT("airplane.cpp");
int getInput(int max);
void getItems(int& speed, int& dir, int& alt);
int main(int argc, char **argv)
{
  char returnMsg[100];
  //
  //Ñîçä**èå ì*ññèâ* óê*ç*òåëåé ** îáúåêòû
  //è òðåõ îáúåêòîâ Airplane
  //
  Airplane* planes[3];
  planes[0] = new Airplane("TWA 1040");
  planes[1] = new Airplane("Unitae Express 749", COMMUTER);
  planes[2] = new Airplane("Cessna 3238T", PRIVATE);
  //
  //Í*÷*ëî öèêë*
  //
  do {
    int plane, message, speed, altitude, direction;
    speed = altitude = direction = -1;
    //
    //Âûáîð ñ*ìîëåò*, êîòîðîìó *äðåñîâ**î ñîîáùå*èå
    //Âûâîä ñïèñê* ñ*ìîëåòîâ è îæèä**èå âûáîð* ïîëüçîâ*òåëÿ
    //
    cout << endl << "Who do you want to send a message to?";
    cout << endl << endl << "0. Quit" << endl;
    for (int i=0; i<3; i++)
      cout << i+1 << ". " << planes[i]->name << endl;
    //
    //Âûçîâ ôó*êöèè getInput() äëÿ ïîëó÷å*èÿ *îìåð* ñ*ìîëåò*
    //
    plane = getInput(4);
    //
    //Åñëè ïîëüçîâ*òåëü âûáèð*åò ïó*êò 0, âûõîä èç öèêë*
    //
    if (plane == -1) break;
    //
    //Ïîäòâåðæäå*èå
    //
    cout << endl << planes[plane]->name << ", roger.";
    cout << endl << endl;
    //
    //Âûáîð êîì**äû
    //
    cout << "What message do you want to send?" << endl;
    cout << endl << "0. Quit" << endl;
    cout << "1. State Change" << endl;
    cout << "2. Take Off" << endl;
    cout << "3. Land" << endl;
    cout << "4. Report Status" << endl;
    message = getInput(5);
    //
    //Âûõîä èç öèêë*, åñëè ïîëçîâ*òåëü âûáð*ë ïó*êò 0
    //
    if (message == -1) break;
    //
    //Åñëè ïîëüçîâ*òåëü âûáð*ë ïó*êò 1, *åîáõîäèìî
    //ââåñòè *îâóþ ñêîðîñòü, **ïð*âëå*èå è âûñîòó.
    //Âûçîâ ôó*êöèè getItems()
    //
    if (message == 0)
      getItems(speed, direction, altitude);
    //
    //Ïåðåä*÷* êîì**äû ñ*ìîëåòó
    //
    bool goodMsg = planes[plane]->SendMessage(message,
      returnMsg, speed, direction, altitude);
    //
    //Êîì**ä* *å ð*ñïîç****
    //
    if (!goodMsg) cout << endl << "Unable to comply.";
    //
    //Âûâîä îòêëèê* ñ*ìîëåò*
    //
    cout << endl << returnMsg << endl;
  } while (1);
  //
  //Ó*è÷òîæå*èå îáúåêòîâ Airplane
  //
  for (int i = 0; i<3; i++) delete planes[i];
}
int getInput(int max)
{
  int choice;
  do {
    choice = getch();
    choice -=49;
  } while (choice < -1 || choice > max);
  return choice;
}
void getItems(int& speed, int& dir, int& alt)
{
  cout << endl << "Enter new speed: ";
  getch();
  cin >> speed;
  cout << "Entet new heading: ";
  cin >> dir;
  cout << "Enter new altitude: ";
  cin >> alt;
  cout << endl;
}
.
I.M.
   I.M.
564 / 547 / 5
: 16.12.2011
: 1,389
15.11.2012, 13:58     [Linked Error] Unresolved External #2
SendMessage
MySendMessage ,
Rifle
   Rifle
25 / 25 / 5
: 15.11.2012
: 93
: 4
15.11.2012, 14:22  []     [Linked Error] Unresolved External #3
, . , , ?
I.M.
   I.M.
564 / 547 / 5
: 16.12.2011
: 1,389
15.11.2012, 14:26     [Linked Error] Unresolved External #4
windows define SendMessage SendMessageA ( SendMessageW - )
,
h
-
Rifle
   Rifle
25 / 25 / 5
: 15.11.2012
: 93
: 4
15.11.2012, 14:29  []     [Linked Error] Unresolved External #5
. ).
Yandex
15.11.2012, 14:29     [Linked Error] Unresolved External

: 13:57. GMT +3.
- , ,
-
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2016, vBulletin Solutions, Inc.
@Mail.ru