Methods not found in DLL created "undefined reference to"

0

I am trying to use a DLL that I did, the DLL compiles without problems but I can not use it, in the project I did I can instantiate, however when trying to use the DLL methods the compiler gives error.

This is the header (i9corp / grantalk / model / GtAudioDevice.h) of one of my DLL classes. There are more classes in the same project.

#ifndef GT_AUDIODEVICE_H
#define GT_AUDIODEVICE_H

#include <vector>
#include <iostream>
using namespace std;

#ifdef __cplusplus
extern "C" {
#endif


    namespace GranTalk {

        class __declspec (dllexport) GtAudioDevice {
        public:
            GtAudioDevice();
            virtual ~GtAudioDevice();
            void discoveryDevices();

            char* getName();
            void setName(const char* value);

            std::vector<GtAudioDevice*> getInput();
            std::vector<GtAudioDevice*> getOutput();

        private:
            std::vector<GtAudioDevice *> input;
            std::vector<GtAudioDevice *> output;
            char *name;
            unsigned int id;
        };
    }

#ifdef __cplusplus
}
#endif

#endif /* GT_AUDIODEVICE_H */

This is the project I'm using to test

#include <cstdlib>
#include <i9corp/grantalk/model/GtAudioDevice.h>
#include <cstdio>
using namespace std;
using namespace GranTalk;

/*
 * 
 */
int main(int argc, char** argv) {

    GtAudioDevice * d = new GtAudioDevice();
    d->setName("Test");
    fprintf(stdout, "Lendo biblioteca %s", d->getName());
    return 0;
}

If I just give new to instantiate the GtAudioDevice class the project compiles, but if I call the methods it gives error and does not compile. The error that appears in the compiler is:

E:\Workspace\I9Corp\qt\grantalk-sdk-voip-demo/main.cpp:26: undefined reference to 'GranTalk::GtAudioDevice::setName(char const*)'
E:\Workspace\I9Corp\qt\grantalk-sdk-voip-demo/main.cpp:27: undefined reference to 'GranTalk::GtAudioDevice::getName()'
  

The DLL path and DLL have already been configured.

g++     -o dist/Debug/MinGW-Windows/grantalk-sdk-voip-demo build/Debug/MinGW-Windows/main.o -L../grantalk-sdk-voip/dist/Debug/MinGW-Windows -lgrantalk-sdk-voip
    
asked by anonymous 01.10.2018 / 17:09

0 answers