Hasan H
Hasan H

Reputation: 141

Undefined Reference for implemented static function

I am trying to to build a dynamic library (.so) for an application. This library uses another static library of my own which has a static function.

Whenever I try to add my dynamic library to the linker of the test application, I get an undefined reference error to one of the functions in the static library:

libLinux_CaptureEngine.so: undefined reference to `ComplexConjugate::complexConjugate(std::complex)'

This is the implementation of this function:

Header file:

class ComplexConjugate
{
public:
    static std::complex<double> complexConjugate(std::complex<double> value);
    
};

cpp file:

#include "ComplexConjugate.h"

std::complex<double> ComplexConjugate::complexConjugate(std::complex<double> value)
{
    std::complex<double> result = std::complex<double>(value.real(), -1 * value.imag());

    return result;
}

I am using NetBeans IDE and I added the static library project to the linker of the dynamic library, with these compiler options -fPIC -pthread -fopenmp -lrt

All other functions work fine, it's just this one function.

Upvotes: 0

Views: 44

Answers (0)

Related Questions