Undefined reference

General questions regarding the usage of CodeLite
Blink123123
CodeLite Curious
Posts: 4
Joined: Wed Apr 11, 2018 12:24 pm
Genuine User: Yes
IDE Question: C++
Contact:

Undefined reference

Post by Blink123123 »

Hello,

I am using CodeLite to test my attempts at some C++ coding, however I have an issue with imports.

I have created a new workspace with a new wxWidgets frame as GUI.
Then I added another static library project (The default one not the wxWidgets enabled project nor the MSVC one).
Then I create a simple class inside my static library.

The problem occurs when I reference it in wxWidgets:
If I use #include "Proj/Class.h"
I get "undefined reference to Class::Class()" and "undefined reference to Class::~Class()"
However if I use #include "Proj/Class.cpp" everything compiles good.

Now I checked and found that this is an issue with the linker or something but everything looks good and the cpp file should be included but its not.
I'm using a fresh VM install with Ubuntu Xenial on it with ONLY CodeLite installed so I don't think any 3rd party issue is present.
User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Undefined reference

Post by eranif »

This is a C++ issue and not CodeLite issue.

Some hints:
Yous should not include .cpp files...
Make sure that the class 'Class.cpp' is part of your project and is compiled.
Make sure you have read the HOW TO POST thread
Locked