C++ Compiler Error in Cygwin: What Is It?

  • Context: C/C++ 
  • Thread starter Thread starter Logarythmic
  • Start date Start date
  • Tags Tags
    C++ Compiler Error
Click For Summary

Discussion Overview

The discussion revolves around a C++ compiler error encountered while using Cygwin, specifically an "undefined reference" error related to a destructor in a class. Participants explore potential causes and solutions related to code structure and linking issues.

Discussion Character

  • Technical explanation, Debate/contested, Homework-related

Main Points Raised

  • One participant describes encountering an "undefined reference" error for the destructor of class Person.
  • Another participant suggests that the error may be due to the absence of a destructor or missing linked code.
  • A different participant asserts that the destructor is defined but expresses confusion about the error.
  • Another reply proposes that the issue might stem from referencing the class before its declaration or possibly a syntax error, such as a missing semicolon.
  • One participant reports resolving the issue by realizing they forgot to include the .cpp file in their project.

Areas of Agreement / Disagreement

Participants express differing views on the cause of the error, with no consensus reached on the underlying issue until one participant identifies a solution.

Contextual Notes

Some assumptions about code structure and linking processes are not explicitly stated, and the discussion does not clarify the specific code details that led to the error.

Logarythmic
Messages
277
Reaction score
0
I'm trying to learn C++ and am using Cygwin. When I try to compile my program I get the message

/cygdrive/c/DOCUME~1/Stoffe/LOKALA~1/Temp/ccQt0yU6.o:driver.cpp:(.text+0x9d6): undefined reference to `Person::~Person()´

What is this kind of error?
 
Technology news on Phys.org
It looks like you don't have a destructor for class Person. Or you are bringing in/linking in some code that is missing something. I can't tell.
 
The destructor is well defined. I really can't find anything wrong..
 
Post your code. You must be referencing the class "Person", before it has been declared. Or else it must be something very similar.

Sometimes, these errors can even be caused by a missed semicolon at the end of a class declaration.
 
I found it. I forgot to include the .cpp at the bottom. ;)
 

Similar threads

  • · Replies 12 ·
Replies
12
Views
4K
Replies
6
Views
3K
  • · Replies 22 ·
Replies
22
Views
4K
  • · Replies 0 ·
Replies
0
Views
3K
Replies
14
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 17 ·
Replies
17
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K