Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6122159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:51:58+00:00 2026-05-23T15:51:58+00:00

Possible Duplicate: What is an undefined reference/unresolved external symbol error and how do I

  • 0

Possible Duplicate:
What is an undefined reference/unresolved external symbol error and how do I fix it?

I’m relatively new to C++ (as you can probably tell by the question) and I’ve hit a problem. I have two files: Drives.h and Drives.cpp

Drives.h

#pragma once

enum MountMode
{
    User,
    System,
    Both,
    Auto
};

class Drive
{
public:
    Drive(void);
    ~Drive(void);

    BOOL Mount(MountMode mode);
    VOID Unmount(void);
    BOOL IsConnected(void);

    static char* DeviceName;
    static char* DrivePath;
};

class Drives
{
public:
    Drives(void);
    ~Drives(void);
};

and my Drives.cpp:

#include "stdafx.h"
#include "Drives.h"

Drives::Drives(void)
{
    Drive USB0; //Error happening here
}

Drives::~Drives(void)
{
}

The error is saying that the Drives class constructor, destructor and IsConnected() are all unresolved externals. I’m not sure what I’m missing since I set this class up like the one on cplusplus.com

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:51:59+00:00Added an answer on May 23, 2026 at 3:51 pm

    As the error message says, you have not implemented the constructor and destructor of Drive:

    Drive::Drive(void) {
        ...
    }
    
    Drive::~Drive(void) {
        ...
    }
    

    Creating a local variable of class type (as you do in Drive USB0;) will invoke that class’ constructor, and the destructor will be invoked at the end of the variable’s scope; hence the error.

    You should implement the other functions of Drive too – declaring a function in a class declaration is essentially a promise that the function will be implemented somewhere.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: What is an undefined reference/unresolved external symbol error and how do I
Possible Duplicate: What is an undefined reference/unresolved external symbol error and how do I
Possible Duplicate: Undefined reference - C++ linker error Now, I'm getting an Undefined reference
Possible Duplicate: sem_open() error: “undefined reference to sem_open()” on linux (Ubuntu 10.10) Having issues
Possible Duplicate: Why can templates only be implemented in the header file? Undefined reference
Possible Duplicate: Error : get property of non-object I am new to codeigniter model,
Possible Duplicate: g++ undefined reference to typeinfo Undefined symbols “vtable for …” and “typeinfo
Possible Duplicate: “Undefined reference to” template class constructor I've just started using templates, and
Possible Duplicate: delete[] supplied a modified new-ed pointer. Undefined Behaviour? Let's say I've allocated
Possible Duplicate: Undefined Symbol ___gxx_personality_v0 on link I have a problem with the following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.