Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Link error: LNK2001 Fatal error

Link error: LNK2001 Fatal error

Scheduled Pinned Locked Moved C / C++ / MFC
c++performancehelp
5 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    PCuong1983
    wrote on last edited by
    #1

    Hi all, I have some problems with my program. My source is follow //Address.h #include #include class Address { public: Address() : _street(0), _city(0), _country(0){} Address(char* street, char* city, char* country) : _street(street), _city(city), _country(country) {} ~Address(){std::cout<<"Free memory: "<<std::endl;} public: void SetStreet(char* street){this->_street = street;} char* GetStreet()const{return this->_street;} void SetCity(char* city){this->_city = city;} char* GetCity()const{return this->_city;} void SetCountry(char* country){this->_country = country;} char* GetCountry()const{return this->_country;} friend std::ostream& operator<<(std::ostream& os, const Address& add){os<<"Address: "<<add._street<<" - "<<add._city<<" - "<<add._country<<std::endl; return os;} private: char* _street; char* _city; char* _country; }; //Common.h typedef unsigned int BYTE; enum Method : BYTE{Cash=1, BankTransfer=2, CreditCard=3}; enum OrderStatus : BYTE{Booked=1, BookedNotConfirmed=2, CheckedIn=3, CheckedOut=4, Confirmed=5}; enum RoomType : BYTE {Single = 1, Double = 2, Triple = 3}; typedef unsigned long ULONG; #define TICKS_IN_DAY 86400 // = 24 * 60 * 60 /////////////////////////// // Hotel.cpp #include #include #include #include #include #include "Common.h" #include "Address.h" class Room { public: Room(void); Room(char rid[3], char* name, RoomType type, BYTE noroom, float price, float taxrate, char* notes) : _rid(rid), _name(name), _type(type), _noroom(noroom), _price(price), _taxrate(taxrate), _notes(notes){} void SetRID(char rid[3]){_rid = rid;} char* GetRID()const{return _rid;} void SetName(char* sname){_name = sname;}; char* GetName()const{return _name;} void SetType(RoomType type){_type = type;} RoomType GetType()const{return _type;} void SetNoRoom(BYTE noroom){_noroom = noroom;} BYTE GetNoRoom()const{return _noroom;} void SetPrice(float price){if(price < 0) _price = 0; else _price = price;} float GetPrice()const{return _price;} void SetTaxRate(float taxrate){_taxrate = taxrate;} float GetTaxRate()const{return _taxrate;} void SetNotes(char* snotes){_notes = snotes;} char* GetNotes()const{return _notes;} public: friend bool operator==(const Room& lr, const Room& rr){return bool(strcmp(lr._rid, rr._rid) == 0);} friend bool operator>(const Room& lr, const Room& rr){return bool(strcmp(lr._rid, r

    R C T 3 Replies Last reply
    0
    • P PCuong1983

      Hi all, I have some problems with my program. My source is follow //Address.h #include #include class Address { public: Address() : _street(0), _city(0), _country(0){} Address(char* street, char* city, char* country) : _street(street), _city(city), _country(country) {} ~Address(){std::cout<<"Free memory: "<<std::endl;} public: void SetStreet(char* street){this->_street = street;} char* GetStreet()const{return this->_street;} void SetCity(char* city){this->_city = city;} char* GetCity()const{return this->_city;} void SetCountry(char* country){this->_country = country;} char* GetCountry()const{return this->_country;} friend std::ostream& operator<<(std::ostream& os, const Address& add){os<<"Address: "<<add._street<<" - "<<add._city<<" - "<<add._country<<std::endl; return os;} private: char* _street; char* _city; char* _country; }; //Common.h typedef unsigned int BYTE; enum Method : BYTE{Cash=1, BankTransfer=2, CreditCard=3}; enum OrderStatus : BYTE{Booked=1, BookedNotConfirmed=2, CheckedIn=3, CheckedOut=4, Confirmed=5}; enum RoomType : BYTE {Single = 1, Double = 2, Triple = 3}; typedef unsigned long ULONG; #define TICKS_IN_DAY 86400 // = 24 * 60 * 60 /////////////////////////// // Hotel.cpp #include #include #include #include #include #include "Common.h" #include "Address.h" class Room { public: Room(void); Room(char rid[3], char* name, RoomType type, BYTE noroom, float price, float taxrate, char* notes) : _rid(rid), _name(name), _type(type), _noroom(noroom), _price(price), _taxrate(taxrate), _notes(notes){} void SetRID(char rid[3]){_rid = rid;} char* GetRID()const{return _rid;} void SetName(char* sname){_name = sname;}; char* GetName()const{return _name;} void SetType(RoomType type){_type = type;} RoomType GetType()const{return _type;} void SetNoRoom(BYTE noroom){_noroom = noroom;} BYTE GetNoRoom()const{return _noroom;} void SetPrice(float price){if(price < 0) _price = 0; else _price = price;} float GetPrice()const{return _price;} void SetTaxRate(float taxrate){_taxrate = taxrate;} float GetTaxRate()const{return _taxrate;} void SetNotes(char* snotes){_notes = snotes;} char* GetNotes()const{return _notes;} public: friend bool operator==(const Room& lr, const Room& rr){return bool(strcmp(lr._rid, rr._rid) == 0);} friend bool operator>(const Room& lr, const Room& rr){return bool(strcmp(lr._rid, r

      R Offline
      R Offline
      Rajesh R Subramanian
      wrote on last edited by
      #2

      Please read the guidelines[^] before making another post. Please use the "code block" option in the formatting pane to post code. Please post only relevant code, explain your query clearly and pin point what is that you need help with.

      Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche .·´¯`·->Rajesh<-·´¯`·. [Microsoft MVP - Visual C++]

      1 Reply Last reply
      0
      • P PCuong1983

        Hi all, I have some problems with my program. My source is follow //Address.h #include #include class Address { public: Address() : _street(0), _city(0), _country(0){} Address(char* street, char* city, char* country) : _street(street), _city(city), _country(country) {} ~Address(){std::cout<<"Free memory: "<<std::endl;} public: void SetStreet(char* street){this->_street = street;} char* GetStreet()const{return this->_street;} void SetCity(char* city){this->_city = city;} char* GetCity()const{return this->_city;} void SetCountry(char* country){this->_country = country;} char* GetCountry()const{return this->_country;} friend std::ostream& operator<<(std::ostream& os, const Address& add){os<<"Address: "<<add._street<<" - "<<add._city<<" - "<<add._country<<std::endl; return os;} private: char* _street; char* _city; char* _country; }; //Common.h typedef unsigned int BYTE; enum Method : BYTE{Cash=1, BankTransfer=2, CreditCard=3}; enum OrderStatus : BYTE{Booked=1, BookedNotConfirmed=2, CheckedIn=3, CheckedOut=4, Confirmed=5}; enum RoomType : BYTE {Single = 1, Double = 2, Triple = 3}; typedef unsigned long ULONG; #define TICKS_IN_DAY 86400 // = 24 * 60 * 60 /////////////////////////// // Hotel.cpp #include #include #include #include #include #include "Common.h" #include "Address.h" class Room { public: Room(void); Room(char rid[3], char* name, RoomType type, BYTE noroom, float price, float taxrate, char* notes) : _rid(rid), _name(name), _type(type), _noroom(noroom), _price(price), _taxrate(taxrate), _notes(notes){} void SetRID(char rid[3]){_rid = rid;} char* GetRID()const{return _rid;} void SetName(char* sname){_name = sname;}; char* GetName()const{return _name;} void SetType(RoomType type){_type = type;} RoomType GetType()const{return _type;} void SetNoRoom(BYTE noroom){_noroom = noroom;} BYTE GetNoRoom()const{return _noroom;} void SetPrice(float price){if(price < 0) _price = 0; else _price = price;} float GetPrice()const{return _price;} void SetTaxRate(float taxrate){_taxrate = taxrate;} float GetTaxRate()const{return _taxrate;} void SetNotes(char* snotes){_notes = snotes;} char* GetNotes()const{return _notes;} public: friend bool operator==(const Room& lr, const Room& rr){return bool(strcmp(lr._rid, rr._rid) == 0);} friend bool operator>(const Room& lr, const Room& rr){return bool(strcmp(lr._rid, r

        C Offline
        C Offline
        Cedric Moonen
        wrote on last edited by
        #3

        Please format your code properly using the "code block" tag, it's almost unreadable. Did you define your static variable in a cpp file ?

        Cédric Moonen Software developer
        Charting control [v1.5] OpenGL game tutorial in C++

        1 Reply Last reply
        0
        • P PCuong1983

          Hi all, I have some problems with my program. My source is follow //Address.h #include #include class Address { public: Address() : _street(0), _city(0), _country(0){} Address(char* street, char* city, char* country) : _street(street), _city(city), _country(country) {} ~Address(){std::cout<<"Free memory: "<<std::endl;} public: void SetStreet(char* street){this->_street = street;} char* GetStreet()const{return this->_street;} void SetCity(char* city){this->_city = city;} char* GetCity()const{return this->_city;} void SetCountry(char* country){this->_country = country;} char* GetCountry()const{return this->_country;} friend std::ostream& operator<<(std::ostream& os, const Address& add){os<<"Address: "<<add._street<<" - "<<add._city<<" - "<<add._country<<std::endl; return os;} private: char* _street; char* _city; char* _country; }; //Common.h typedef unsigned int BYTE; enum Method : BYTE{Cash=1, BankTransfer=2, CreditCard=3}; enum OrderStatus : BYTE{Booked=1, BookedNotConfirmed=2, CheckedIn=3, CheckedOut=4, Confirmed=5}; enum RoomType : BYTE {Single = 1, Double = 2, Triple = 3}; typedef unsigned long ULONG; #define TICKS_IN_DAY 86400 // = 24 * 60 * 60 /////////////////////////// // Hotel.cpp #include #include #include #include #include #include "Common.h" #include "Address.h" class Room { public: Room(void); Room(char rid[3], char* name, RoomType type, BYTE noroom, float price, float taxrate, char* notes) : _rid(rid), _name(name), _type(type), _noroom(noroom), _price(price), _taxrate(taxrate), _notes(notes){} void SetRID(char rid[3]){_rid = rid;} char* GetRID()const{return _rid;} void SetName(char* sname){_name = sname;}; char* GetName()const{return _name;} void SetType(RoomType type){_type = type;} RoomType GetType()const{return _type;} void SetNoRoom(BYTE noroom){_noroom = noroom;} BYTE GetNoRoom()const{return _noroom;} void SetPrice(float price){if(price < 0) _price = 0; else _price = price;} float GetPrice()const{return _price;} void SetTaxRate(float taxrate){_taxrate = taxrate;} float GetTaxRate()const{return _taxrate;} void SetNotes(char* snotes){_notes = snotes;} char* GetNotes()const{return _notes;} public: friend bool operator==(const Room& lr, const Room& rr){return bool(strcmp(lr._rid, rr._rid) == 0);} friend bool operator>(const Room& lr, const Room& rr){return bool(strcmp(lr._rid, r

          T Offline
          T Offline
          toxcct
          wrote on last edited by
          #4

          and because two answers are not enough in your case, i'm repeating it to you (to be sure you got it well) : you are supposed to post formatted relevant code only (not a huge copy/paste of an entiere file) !!!

          [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

          R 1 Reply Last reply
          0
          • T toxcct

            and because two answers are not enough in your case, i'm repeating it to you (to be sure you got it well) : you are supposed to post formatted relevant code only (not a huge copy/paste of an entiere file) !!!

            [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

            R Offline
            R Offline
            Rajesh R Subramanian
            wrote on last edited by
            #5

            toxcct wrote:

            you are supposed to post formatted relevant code only (not a huge copy/paste of an entiere file) !!!

            Very well said. Why do some people think that someone on the internet will have the time to wade through the entire lot of code they post? :doh:

            Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche .·´¯`·->Rajesh<-·´¯`·. [Microsoft MVP - Visual C++]

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups