Sash
Sash

Reputation: 4598

Setting up a library in Eclipse CDT

I am creating a project which needs to use the libnoise headers. However I am having difficulty compiling.

I have put the headers into my src/ directory of my project, so I am able to include them with

#include "noise/noise.h"
#include "noise/noisegen.h"
#include "noiseutils.h"

But when I try and create a Perlin module noise::module::Perlin perlinModule;, I get the following compilation error:

PROJECTDIR\bin/../src/libnoise_wrapper.cpp:66: undefined reference to `noise::module::Perlin::Perlin()'
./src/libnoise_wrapper.o: In function `~Perlin':
PROJECTDIR\bin/../src/noise/module/perlin.h:160: undefined reference to `vtable for noise::module::Perlin'
PROJECTDIR\bin/../src/noise/module/perlin.h:160: undefined reference to `noise::module::Module::~Module()'
PROJECTDIR\bin/../src/noise/module/perlin.h:160: undefined reference to `vtable for noise::module::Perlin'
PROJECTDIR\bin/../src/noise/module/perlin.h:160: undefined reference to `noise::module::Module::~Module()

I have created a Project Include reference to the /src/noise folder as well as noiseutils.h file (which is in the src/ directory itself).

Are there any other configurations I am missing?

Upvotes: 2

Views: 126

Answers (1)

πάντα ῥεῖ
πάντα ῥεῖ

Reputation: 1

"I have put the headers into my src/ directory of my project, so I am able to include them with "

That's not the usual way to do! You should have an installation of this library in your environment (there are some instructions how to do this for your particular case available in this tutorial from the libnoise online documentation), and add the additional include paths to search using the

Project Properties->C/C++ Build->Settings-><actual C++ Compiler>->Includes->Include paths (-I)

enter image description here settings.

"Are there any other configurations I am missing?"

Check the

Project Properties->C/C++ Build->Settings-><actual toolchain linker>->Libraries

enter image description here

properties page.

You'll need to provide noise in the Libraries list there, and eventually an additional Library search path pointing to the actual libs installation. The latter depends on how and where you have the libnoise installed in your environment.

Upvotes: 1

Related Questions