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

In summary, the conversation discusses an error message that occurs when trying to compile a C++ program using Cygwin. The error is caused by a missing destructor for the class "Person" or by referencing the class before it has been declared. It is also mentioned that missing semicolons in class declarations can also cause this error.
  • #1
Logarythmic
281
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
  • #2
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.
 
  • #3
The destructor is well defined. I really can't find anything wrong..
 
  • #4
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.
 
  • #5
I found it. I forgot to include the .cpp at the bottom. ;)
 

1. What is a C++ compiler error in Cygwin?

A C++ compiler error in Cygwin is an error message that appears when there is a problem with compiling a C++ program in the Cygwin environment. This can happen due to a variety of reasons such as syntax errors, missing libraries, or conflicts with other code.

2. How do I fix a C++ compiler error in Cygwin?

The best way to fix a C++ compiler error in Cygwin is to carefully read the error message and identify the source of the problem. This could be a missing semicolon, a typo, or a missing library. Once identified, the error can be fixed by making the necessary changes to the code.

3. Why am I getting a C++ compiler error in Cygwin?

There are several reasons why you might be getting a C++ compiler error in Cygwin. Some common reasons include syntax errors, compatibility issues, and missing libraries. It is important to carefully review the error message to determine the cause of the error.

4. Can I use any C++ compiler with Cygwin?

Cygwin is compatible with several C++ compilers such as GNU Compiler Collection (GCC) and Clang. However, it is recommended to use the GCC compiler as it is the default compiler in Cygwin and is well-supported.

5. How can I prevent C++ compiler errors in Cygwin?

To prevent C++ compiler errors in Cygwin, it is important to write clean and error-free code. This includes using proper syntax, avoiding conflicting libraries, and regularly testing the code. It is also helpful to refer to Cygwin's documentation and forums for any troubleshooting tips and advice.

Similar threads

Replies
6
Views
1K
  • Programming and Computer Science
Replies
12
Views
2K
  • Programming and Computer Science
Replies
22
Views
2K
  • Programming and Computer Science
Replies
14
Views
2K
  • Programming and Computer Science
Replies
2
Views
843
  • Programming and Computer Science
Replies
17
Views
1K
  • Programming and Computer Science
Replies
2
Views
376
  • Programming and Computer Science
Replies
4
Views
3K
  • Programming and Computer Science
Replies
1
Views
259
  • Programming and Computer Science
Replies
1
Views
1K
Back
Top