porterneon
5th March 2011, 23:33
Hello.
I have library that has been written in Ansi C named "edr.a" and header file "edr.h". Library hass been compiled on 32-bit ubuntu and is linked into project but I get undefined references to all methods defined in header file.
Please take a look on this simple example:
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "edr.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
SetDebugMode(); // this is method defined in edr.h
}
edr.h file:
long SetDebugMode(void);
long ClearDebugMode(void);
This is what compilator is showing:
g++ -c -m32 -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/lib64/qt4/mkspecs/linux-g++-32 -I../Lib -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include -I../LinkowanieBiblioteki -I../Lib -I. -I. -I. -o moc_mainwindow.o moc_mainwindow.cpp
g++ -m32 -o LinkowanieBiblioteki main.o mainwindow.o moc_mainwindow.o -L -ledr -lQtGui -lQtCore -lpthread
mainwindow.o: In function `MainWindow':
/home/neon/workspace/qt4/LinkowanieBiblioteki-build-desktop/../LinkowanieBiblioteki/mainwindow.cpp:14: undefined reference to `SetDebugMode'
What I'm doing wrong? How to use linked external library written in Ansi C?
I have library that has been written in Ansi C named "edr.a" and header file "edr.h". Library hass been compiled on 32-bit ubuntu and is linked into project but I get undefined references to all methods defined in header file.
Please take a look on this simple example:
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "edr.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
SetDebugMode(); // this is method defined in edr.h
}
edr.h file:
long SetDebugMode(void);
long ClearDebugMode(void);
This is what compilator is showing:
g++ -c -m32 -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/lib64/qt4/mkspecs/linux-g++-32 -I../Lib -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include -I../LinkowanieBiblioteki -I../Lib -I. -I. -I. -o moc_mainwindow.o moc_mainwindow.cpp
g++ -m32 -o LinkowanieBiblioteki main.o mainwindow.o moc_mainwindow.o -L -ledr -lQtGui -lQtCore -lpthread
mainwindow.o: In function `MainWindow':
/home/neon/workspace/qt4/LinkowanieBiblioteki-build-desktop/../LinkowanieBiblioteki/mainwindow.cpp:14: undefined reference to `SetDebugMode'
What I'm doing wrong? How to use linked external library written in Ansi C?