PDA

View Full Version : QextSerialPort installation on Win7 fails (Linker errors)



sHs
13th November 2012, 22:25
Hi, I use Qt 4.7.4 on Win7 with Visual Studio 2010(64bit).

I wanted to install QextSerialPort as static library, and I followed the instructions here (http://code.google.com/p/qextserialport/wiki/QextSerialPort_1_2_Beta2#Usage%283%29%EF%BC%9AShar ed_or_Static_Library_Without_Installation).
It says:

Usage(3):Shared or Static Library Without Installation

If I don't want to install the library to my system. How should I do?

It's easy too. ;-)

1. 【Config】 Write a config.pri file.(read config_example.pri for reference):

shared library
static library

2. 【Build】 Changed to subdirectory buildlib, run


qmake
make

shared or static library will be generated.

3. 【Usage】 Add following line to your qmake project file:


# xxxx.pro
include(pathToPri/qextserialport.pri)

My question: What did I do wrong when I did the following:
And yet another thing: Is it possible that I have to install certain drivers before I install QextSerialPort ?

So I started with the config.pri file.
It now looks like this:

# This is an example config.pri for building and using qextserialport.
#
# When using the qextserialport, all you need is to add following line
# in your .pro file:
# include(pathToQextserialport/src/qextserialport.pri)
#
# uncomment the following line if you want to use qextserialport as library
QEXTSERIALPORT_LIBRARY = yes

# uncomment the following line too if you want to use it as static library
QEXTSERIALPORT_STATIC = yes

# comment following line if you always want to enable "udev" under linux
# QEXTSERIALPORT_WITH_UDEV = yes


I run qmake in the buildlib directory, then nmake. (I copied qmake.exe in that folder, then worked with Visual Studio Command Prompt x64. I guess this is not the usual way to do this?)
Anyway, it did its job without errors.
Then I edited my .pro file to look like this:
(I added include(QExtSerialPort/src/qextserialport.pri))

#Schnarchdaten_Reader
#--------------------------------------------------

TEMPLATE = app
CONFIG += qt
QT += core gui

#--------------------------------------------------

HEADERS += schnarchdaten_reader.h\
datentyp.h\
Buffer.h\
qcustomplot.h

#--------------------------------------------------

SOURCES += main.cpp\
schnarchdaten_reader.cpp\
Datentyp.cpp\
Buffer.cpp\
qcustomplot.cpp

#--------------------------------------------------

include(QExtSerialPort/src/qextserialport.pri)

#--------------------------------------------------

FORMS += schnarchdaten_reader.ui

#--------------------------------------------------

TARGET = Schnarchdaten_Reader

#--------------------------------------------------

Now I create a new project in Visual Studio by Qt->Open .pro-file
My new project is being put together.
But when I try to Compile and Run, I get that weird message "error LNK1104: File"\.obj" can't be opened."

Though, the QextSerialPort class is getting recognized and I can use it to create objects and use functions.

I tried to change my .pro modification to include(Schnarchdaten_Reader/QExtSerialPort/src/qextserialport.pri)
I think this is wrong, because my projects directory is: like this:

Schnarchdaten_Reader

.pro file

QExtSerialPort

folders and files of QExtSerialPort



But: After doing the same stuff as described above I can at least start the project, but as soon as I make a new QextSerialPort Object I get Linker errors refering to QextSerialPort.

Which would be the right setting for that?

I have spent the whole day trying to fix that, so any help/guess/hint is highly appreciated.

Sorry for the long post and thank you very much for reading it! :)

Greetings
sHs

sHs
14th November 2012, 19:20
#SOLVED: I was clueless about the fact that you need to copy the generated .libs to your QT.DIRECTORY/lib
It was obvious that something couldnt be found, so yeah. Thats important ... =/