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 8799949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:27:35+00:00 2026-06-14T00:27:35+00:00

I am trying to get my makefile working, but it is giving me some

  • 0

I am trying to get my makefile working, but it is giving me some errors and I can’t get it to work.

 OBJS = Kmeans.o cluster.o data.o 
    CC = g++
    DEBUG = -g
    CFLAGS = -Wall -c $(DEBUG)
    LFLAGS = -Wall $(DEBUG)

    clustering : $(OBJS)
        $(CC) $(LFLAGS) $(OBJS) -o clustering

    Kmeans.o : Kmeans.h Kmeans.cpp cluster.h data.h
        $(CC) $(CFLAGS) Kmeans.cpp

cluster.o : cluster.h cluster.cpp data.h 
    $(CC) $(CFLAGS) cluster.cpp

data.o : data.h data.cpp 
    $(CC) $(CFLAGS) data.cpp

clean:
    \rm *.o *~ clustering

And the files are:

clustering.cpp -> #include "Kmeans.h"
Kmeans.cpp     -> #include "Kmeans.h"
Kmeans.h       -> #include "cluster.h"
cluster.cpp    -> #include "cluster.h"
cluster.h      -> #include "data.h"
data.cpp       -> #include "data.h"

What am I doing wrong?

Edit:
Sorry, I forgot to include the errors:

Kmeans.o: In function `Kmeans::read(char*)':
Kmeans.cpp:(.text+0x53c): undefined reference to `Data::~Data()'
cluster.o: In function `Cluster::Cluster(int, int, int)':
cluster.cpp:(.text+0x45): undefined reference to `Data::~Data()'
cluster.cpp:(.text+0x80): undefined reference to `Data::~Data()'
cluster.o: In function `Cluster::Cluster()':
cluster.cpp:(.text+0xca): undefined reference to `Data::~Data()'
cluster.cpp:(.text+0x110): undefined reference to `Data::~Data()'
cluster.o: In function `Cluster::setData(int, int, int)':
cluster.cpp:(.text+0x158): undefined reference to `Data::~Data()'
collect2: ld devolvió el estado de salida 1
make: *** [clustering] Error 1

Thanks!

I compile each file and the problem is in the last line:

g++    -c -o clustering.o clustering.cpp
g++    -c -o data.o data.cpp
g++    -c -o Kmeans.o Kmeans.cpp
g++    -c -o cluster.o cluster.cpp
g++    -o clustering clustering.o data.o Kmeans.o cluster.o    <----
  • 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-06-14T00:27:37+00:00Added an answer on June 14, 2026 at 12:27 am

    It seems that you have Data::~Data declaration in data.h and you do not have definition anywhere.

    Just remove the declaration from header or add empty definition it it’s a virtual destructor.

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

Sidebar

Related Questions

I'm trying to get some information about my Android Makefile, but echo doesn't work
Trying to get this expression to work, can someone look at it and tell
I'm trying to debug a complex Makefile. How do you get GNU make to
I was trying to get the fbounds checking to work, but I did not
I am trying get Struts 2 and Tiles to work and I am using
I'm trying to produce some graphs using GNUplot with a makefile. I would like
I'm trying to get tipfy working on Google App Engine (GAE). I'm using Windows
After a whole week of trying to get GTK working on Cygwin and MinGW
I'm having some trouble with the bane of my existance, the Makefile. I'm trying
I have been trying for some time now to get my Rails development environment

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.