0

[EDIT] So this issue can be solved if I add a -llibraryname when I compile from a command line.

If this code were a part of a bigger code, would it be correct to say that in your Makefile, you append the library name parameter?

I am currently trying to implement a C++ library called FuzzyLite and have ran into a problem which I can't seem to solve.

I downloaded the latest library and did make on the .cpp files, so the correct header files and library files (.so and .a) are in:

/usr/local/lib
/usr/local/include

Now, if I understand how links and classes work correctly, I believe that I should be able to compile the following code without any issues.

sampledimmer.cpp #include "fl/Headers.h"

int main(int argc, char* argv[]){
    using namespace fl;
    Engine* engine = new Engine("simple-dimmer");
}

The error I encounter when I try to compile using Sublime Text is the following:

/tmp/cc1r7WtZ.o: In function 'main':
sampledimmer.cpp:(.text+0x4b): undefined reference to `fl::Engine::Engine(std::string const&)'
collect2: error: ld returned 1 exit status
[Finished in 0.3s with exit code 1]

The actual sampledimmer.cpp is longer, but the error I receive is the same:

undefined reference to

So I believe that the core issue is the same. I've been trying to figure this out for the last day, but I guess there is a key misunderstanding on my part with implementing libraries.

Any help would be much appreciated.

Static
  • 1
  • 2

0 Answers0