I'm trying to build a project with a library (dll) I made. I've never attempted to either load or make a library before and I'm getting the following error.
error: undefined reference to `imp__ZN6NeuronC1Ev'
In Qt, the error is shown in the following line.
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow) <--------------------------- Error indicated here.
{
ui->setupUi(this);
}
Project File
QT += core gui
TARGET = Jane
TEMPLATE = app
LIBS += -L quote(C:\Programming\Jane\Jane\Source\Neuron.dll)
SOURCES += main.cpp\
MainWindow.cpp
HEADERS += MainWindow.h
FORMS += MainWindow.ui
Here is one of the classes that I've exported
#ifndef NEURON_H
#define NEURON_H
#include <QList>
#include "Neuron_global.h"
#include <Sensor.h>
class NEURONSHARED_EXPORT Neuron
{
public:
explicit Neuron();
const double getOutput() const;
const double & getWeight() const;
void setWeight(const double& weight);
private:
double weight; // The weight of this neuron.
QList<Neuron*> neurons; // This Neuron's children.
QList<Sensor*> sensors; // This Neuron's Sensors.
};
#endif // NEURON_H
The NEURONSHARED_EXPORT Marco is defined in "Neuron_global.h"
#ifndef NEURON_GLOBAL_H
#define NEURON_GLOBAL_H
#include <QtCore/qglobal.h>
#if defined(NEURON_LIBRARY)
# define NEURONSHARED_EXPORT Q_DECL_EXPORT
#else
# define NEURONSHARED_EXPORT Q_DECL_IMPORT
#endif
#endif // NEURON_GLOBAL_H
If anyone has any advice on how to fix this, I would greatly appreciate it.
Edit: I've added the libNeuron.a file to the LIBS argument in pro file. However, I'm now getting the following error.
LIBS += libNeuron.a
cannot find -lNeuron.a
any ideas?
uivariable is declared as a pointer? Not doing so would eliminate the need to initialize it with a dynamic memory allocation, eliminating the supposedly offending line, which may or may not help narrow down the problem further.