Qt-interest Archive, March 2007
Cannot link Qt program using MinGW (Win 32 Open Source)
Pages: Prev | 1 | 2 | Next
Message 1 in thread
I'm trying to link a Qt program that uses two external libraries
to drive a CCD and DAQ board. The CCD lib (pvcam32.lib)
links (at least no errors are generated) but the DAQ library
(nidaq32.lib) does not and gives a slew of errors as if it
were not there, e.g.
"undefined reference to 'DIG_Out_Line'", etc
and lists all the functions that I've referred to in the program.
I've used nm and checked that all the functions are there, e.g.
nm nidiaq32.lib
nidaq32.dll:
00000000 i .idata$4
00000000 i .idata$5
00000000 t .text
000420ff a @comp.id
00000000 I __imp__DIG_Out_Line@16
U __IMPORT_DESCRIPTOR_nidaq32
00000000 T _DIG_Out_Line@16
and so on.
The Fedora Core version of nm cannot read nidaq32.lib although it
can read pvcam32.lib
I thought it might be an incompatible library so I tried to generate
a .def file using reimp -d : nothing happens (once again pvcam32.lib
produces one).
The library works in Visual Studio 2005 - I've compiled and linked programs
without any difficulty.
The library path is OK, both libraries are in the same directory -
from the .pro file:
LIBS += -Lqextserialport-1.0/build -lqextserialport \
-Llibraries -lpvcam32 -lnidaq32
unix:DEFINES += _TTY_POSIX_
win32:DEFINES += _TTY_WIN_
# install
TARGET=dimQtv2
QT += opengl
I can't use Visual Studio as the machine that this system will
be working on only has Mingw
Any ideas would be welcome as I'm stuck!
DS
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--
[ signature omitted ]
Message 2 in thread
Hi,
> I'm trying to link a Qt program that uses two external libraries
> to drive a CCD and DAQ board. The CCD lib (pvcam32.lib)
> links (at least no errors are generated) but the DAQ library
> (nidaq32.lib) does not and gives a slew of errors as if it
> were not there, e.g.
> "undefined reference to 'DIG_Out_Line'", etc
> and lists all the functions that I've referred to in the program.
> [...]
> The library works in Visual Studio 2005 - I've compiled and linked programs
> without any difficulty.
I guess this nidaq32.lib library is a C++ library. C++ compilers are not
always binary compatible, particularly MinGW and Visual C++.
This nidaq32.lib library has probably been compiled using Visual C++. If
so you cannot use it with programs compiled with MinGW.
Open source libraries (or at the very least libraries sold with sources)
can be recompiled using another compiler. If you don't have the sources
of nidaq32.lib then you can't recompile it and you're stuck with the
compiler it was built with. You could also ask National Instruments
whether they have a version of nidaq32.lib compatible with MinGW.
--
[ signature omitted ]
Message 3 in thread
> to drive a CCD and DAQ board. The CCD lib (pvcam32.lib)
> links (at least no errors are generated) but the DAQ library
> (nidaq32.lib) does not and gives a slew of errors as if it
Correct me if I am wrong, but don't you need ".a" libraries for
GNU-Compilers (i.e. mingw32)? ".lib" sounds to me like a microsoft (msvc)
library. If it is a C++ library, you won't be able to use a different
compiler but the one it was built with (see: "name mangling").
Regards,
Malte
--
[ signature omitted ]
Message 4 in thread
For C libraries, you still can use *.lib files with mingw. This example is
for libmysql.
D:\app\MySQL\5.0\lib\opt>\app\MinGW\bin\reimp.exe -d libmysql.lib
D:\app\MySQL\5.0\lib\opt>\app\MinGW\bin\dlltool.exe -k --input-def
libmysql.def --dllname libmysql.dll --output-lib libmysql.a
fanda
On Fri, 02 Mar 2007 09:01:23 +0100, Malte Witt <malte.witt@xxxxxxxxxxxxx>
wrote:
>> to drive a CCD and DAQ board. The CCD lib (pvcam32.lib)
>> links (at least no errors are generated) but the DAQ library
>> (nidaq32.lib) does not and gives a slew of errors as if it
>
> Correct me if I am wrong, but don't you need ".a" libraries for
> GNU-Compilers (i.e. mingw32)? ".lib" sounds to me like a microsoft (msvc)
> library. If it is a C++ library, you won't be able to use a different
> compiler but the one it was built with (see: "name mangling").
>
> Regards,
> Malte
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
--
[ signature omitted ]
Message 5 in thread
> For C libraries, you still can use *.lib files with mingw. This example
is
> for libmysql.
True. This would "theoretically" also work for C++, but it's quite
unusable because of the different name-mangling of the different tool
chains. So "practically" it's not possible. ;-)
Regards,
Malte
--
[ signature omitted ]
Message 6 in thread
I am not sure if this is a too old question, but hope someone could help
me to make it clear: why for x11 drawing a QImage using drawImage
costs so much longer time than Windows? For my case it's almost 10 times
slower.
Thanks all.
--
[ signature omitted ]
Message 7 in thread
On Friday 02 March 2007 11:03, Shangfeng Du wrote:
> I am not sure if this is a too old question, but hope someone could help
> me to make it clear: why for x11 drawing a QImage using drawImage
> costs so much longer time than Windows? For my case it's almost 10 times
> slower.
I have same trouble with my application.
With output of 25 FPS of 352x288x32 pictures processor (P-M 1.1 in my target
system) used by 50% (half-by-half between my app and X). With same
application build under Windows it takes 1-2% of processor time.
In Windows I have use DirectDraw and OpenGL output for video-output.
In Linux I plan to implement use of OpenGl output. It can helps.
--
[ signature omitted ]
Message 8 in thread
Anatoly,
Under X I suggest using the XVideo Extension. This will make it much
much faster to blit images and also give you hardware scaling. You can
simple turn off the background on your Qt Widget and use X calls to draw
to the window. Some information about XVideo is here:
http://en.wikipedia.org/wiki/XVideo
There is a simpel example program listed there. This willalso require
that you have some major ifdefs on your code or seperate impl files like qt.
--Justin
Anatoly Kanashin wrote:
> On Friday 02 March 2007 11:03, Shangfeng Du wrote:
>
>> I am not sure if this is a too old question, but hope someone could help
>> me to make it clear: why for x11 drawing a QImage using drawImage
>> costs so much longer time than Windows? For my case it's almost 10 times
>> slower.
>>
> I have same trouble with my application.
> With output of 25 FPS of 352x288x32 pictures processor (P-M 1.1 in my target
> system) used by 50% (half-by-half between my app and X). With same
> application build under Windows it takes 1-2% of processor time.
> In Windows I have use DirectDraw and OpenGL output for video-output.
> In Linux I plan to implement use of OpenGl output. It can helps.
>
>
begin:vcard
begin:vcard
fn:Justin Noel
n:Noel;Justin
org:ICS;Engineering
adr:;;54B Middlesex Trpk;Bedford;MA;01730;USA
email;internet:justin@xxxxxxx
title:Sr. Consulting Engineer / Certified Qt Instructor
tel;work:(617) 621-0060
url:http://www.ics.com
version:2.1
end:vcard
Message 9 in thread
On Friday 02 March 2007 11:03, Shangfeng Du wrote:
You may have some speedup if You use QImage::scaled() or same before calling
QPainter::drawImage().
Internally (for Qt4.2.2) QImage::scaled created scaled image by using code
like this:
QImage::scaled(QImage src_image, int new_width, int new_height) {
QImage new_img(new_width, new_height, new_format);
QPainter p(&new_img);
QMatrix mat;
mat.scaled(...);
p.setMatrix(mat);
p.drawImage(src_img);
return new_img;
}
PS: this code only show idea and not exactly reproduced internal Qt code
8o)
--
[ signature omitted ]
Message 10 in thread
Shangfeng Du wrote:
> I am not sure if this is a too old question, but hope someone could help
> me to make it clear: why for x11 drawing a QImage using drawImage
> costs so much longer time than Windows? For my case it's almost 10 times
> slower.
>
> Thanks all.
>
>
This is because QImage memory lives in the X-Client memory space and
QPixmap memory lives in the X-Server memory space. In fact, QPixmpas
may have the luxury of living on graphics card memory under certain
conditions. Regardless, in X the client and server could be very far
away. Even if they are both local there is still going to be bits
passed somewhere.
Infact, I'm pretty sure drawImage is going to convert your image to a
QPixmap on X11 before drawing it. QPixmap == XPixmap for those X druids
out there. The Qt rule of thumb is that QPixmaps are for "drawing" and
rendering and QImages are for direct pixel manipulation (like scaling).
These classes tend to internally convert between one another so
QPixmap::scale() or QPixmap::create...Mask() type calls really convert
to QImage internally. This conversion back and forth is slow. Doing it
yourself will be much faster.
Your problem probably stems from the fact that you are doing too much
work in paintEvent() (Just a guess). You want something like this:
void MyWidget::resizeEvent(...)
{
QImage image = QImage::fromPixmap(m_pixmap);
image.scale(e->size()); //Pixmap would have caused a conversion
QBitmap mask = image.createHeuristicMask(); // Pixmap would have
caused conversion
setMask(mask);
m_pixmap = QPixmap::fromImage(image);
}
void MyWidget::paintEvent(...)
{
QPainter painter(this);
//This is really fast.
painter->drawPixmap(e->rect(), m_pixmap, e->rect());
}
You don't see this on windows because on that platform Image == Pixmap.
--Justin
begin:vcard
begin:vcard
fn:Justin Noel
n:Noel;Justin
org:ICS;Engineering
adr:;;54B Middlesex Trpk;Bedford;MA;01730;USA
email;internet:justin@xxxxxxx
title:Sr. Consulting Engineer / Certified Qt Instructor
tel;work:(617) 621-0060
url:http://www.ics.com
version:2.1
end:vcard
Message 11 in thread
On Friday 02 March 2007 20:18, Justin Noel wrote:
> Your problem probably stems from the fact that you are doing too much
> work in paintEvent() (Just a guess). You want something like this:
>
> void MyWidget::resizeEvent(...)
> {
> QImage image = QImage::fromPixmap(m_pixmap);
> image.scale(e->size()); //Pixmap would have caused a conversion
>
> QBitmap mask = image.createHeuristicMask(); // Pixmap would have
> caused conversion
> setMask(mask);
>
> m_pixmap = QPixmap::fromImage(image);
> }
>
>
> void MyWidget::paintEvent(...)
> {
> QPainter painter(this);
>
> //This is really fast.
> painter->drawPixmap(e->rect(), m_pixmap, e->rect());
> }
It's good idea. But what i could do with video stream? When i draw about 25
frames per second and resize events don't receive?
I thing that using OpenGL only can help.
>
>
> You don't see this on windows because on that platform Image == Pixmap.
>
> --Justin
--
[ signature omitted ]
Message 12 in thread
Anatoly Kanashin wrote:
> On Friday 02 March 2007 20:18, Justin Noel wrote:
>
> void MyWidget::paintEvent(...)
> {
> QPainter painter(this);
>
> //This is really fast.
> painter->drawPixmap(e->rect(), m_pixmap, e->rect());
> }
>
> It's good idea. But what i could do with video stream? When i draw about 25
> frames per second and resize events don't receive?
>
> I thing that using OpenGL only can help.
>
>
I think you might be better off using a platform native video system
like XVideo on X and DirectX on Windows. You would just need an
abstracted API and different source impls like Qt does to support
different platforms. On X11, Xvideo will get you a high frame rate and
some hardware transformations like scaling.
Here is some XVideo info and some example code:
http://en.wikipedia.org/wiki/XVideo
You can turn off the background on your Qt Widget and then use native X
calls to draw to the window whenever you want.
--Justin
begin:vcard
begin:vcard
fn:Justin Noel
n:Noel;Justin
org:ICS;Engineering
adr:;;54B Middlesex Trpk;Bedford;MA;01730;USA
email;internet:justin@xxxxxxx
title:Sr. Consulting Engineer / Certified Qt Instructor
tel;work:(617) 621-0060
url:http://www.ics.com
version:2.1
end:vcard
Message 13 in thread
On Tuesday 06 March 2007 19:55, Justin Noel wrote:
>
> I think you might be better off using a platform native video system
> like XVideo on X and DirectX on Windows. You would just need an
> abstracted API and different source impls like Qt does to support
> different platforms. On X11, Xvideo will get you a high frame rate and
> some hardware transformations like scaling.
>
> Here is some XVideo info and some example code:
> http://en.wikipedia.org/wiki/XVideo
>
> You can turn off the background on your Qt Widget and then use native X
> calls to draw to the window whenever you want.
>
> --Justin
Thanks, I'll try this.
--
[ signature omitted ]
Message 14 in thread
On Tuesday 06 March 2007 19:55, Justin Noel wrote:
> I think you might be better off using a platform native video system
> like XVideo on X and DirectX on Windows. You would just need an
> abstracted API and different source impls like Qt does to support
> different platforms. On X11, Xvideo will get you a high frame rate and
> some hardware transformations like scaling.
>
> Here is some XVideo info and some example code:
> http://en.wikipedia.org/wiki/XVideo
I've try example found on this address. In my target system this can't work -
I think some setup of XVideo needed that i don't know.
I finished OpenGL render and found that this have normal speed. In my target
system I see dynamic and motion:) And CPU isn't 100% busy.
>
> You can turn off the background on your Qt Widget and then use native X
> calls to draw to the window whenever you want.
>
> --Justin
--
[ signature omitted ]
Message 15 in thread
fanda wrote:
>For C libraries, you still can use *.lib files with mingw. This example is
>for libmysql.
>D:\app\MySQL\5.0\lib\opt>\app\MinGW\bin\reimp.exe -d libmysql.lib
>D:\app\MySQL\5.0\lib\opt>\app\MinGW\bin\dlltool.exe -k --input-def
>libmysql.def --dllname libmysql.dll --output-lib libmysql.a
That's precisely what I tried - I downloaded the mingw-utils and tried
reimp -d nidaq32.lib - it produced no output, whereas
reimp -d pvcam32.lib produced a proper .def file
DS
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--
[ signature omitted ]
Pages: Prev | 1 | 2 | Next