[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

getch() virker ikke



Hej med jer

Jeg er ved at lære mig OOP med C++. Jeg har fået en opgave der ligesom
lægger op til at man skal bruge getch().

Når jeg kompilerer mit program under Kdevelop går det fint, men når jeg
skal linke kommer følgende fejl:

ain.o: In function `main': 
/home/ep/Progs/chap6ex2/chap6ex2/main.cpp:63: undefined reference to
`stdscr' 
/home/ep/Progs/chap6ex2/chap6ex2/main.cpp:63: undefined reference to
`wgetch' 
collect2: ld returned 1 exit status 
make[2]: *** [chap6ex2] Error 1 
make[2]: Leaving directory `/home/ep/Progs/chap6ex2/chap6ex2' 
make[1]: Leaving directory `/home/ep/Progs/chap6ex2' 
make[1]: *** [all-recursive] Error 1 
make: *** [all] Error 2 
*** failed *** 

Min kildekode ser således ud:

#include <iostream>
using namespace std;
#include <curses.h>

class tollBooth
{
  private:
    unsigned int cars;
    double money;
  public:
    tollBooth() : cars(0), money(0)
      {     }
    void payingCar();
    void nopayCar();
    void display() const;
    
};

void tollBooth::payingCar()
{
  cars++;
  money+=0.5;
}

void tollBooth::nopayCar()
{
  cars++;
}

void tollBooth::display() const
{
  cout << "Antal biler = " << cars << " og indkomst = " << money;
}

int main()
{
  tollBooth GoldenGate;
  char valg= ' ';

  cout << "Tast '1' når der betales og '2' når der ikke betales" <<
endl;
  
  while (valg != 0x27)
  {
    valg = getch();
    switch (valg)
    {
      case '1':GoldenGate.payingCar();break;
      case '2':GoldenGate.nopayCar();break;
    }
  }
  GoldenGate.display();
  

  return 0;
}

Hvad gør jeg galt???

Egon Petersen





 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:10 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *