Page 1 of 1

Undefined reference

Posted: Wed Apr 11, 2018 4:59 pm
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.

Re: Undefined reference

Posted: Wed Apr 11, 2018 9:34 pm
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.