[Qt-interest] Including Win32 SDK header and Lib dir to my project?

Huan "KDE Zealot" Truong huantnh at gmail.com
Sat Jun 13 13:22:47 CEST 2009


Thanks for the comment, Karol.

Actually I needed to call API functions RegisterDeviceNotification and
UnregisterDeviceNotification (as defined in windows.h) to check if
there is a USB flash drive plugged into the system.

Now the only two errors I had were from link.exe complaining about not
being able to resolve those functions.

mainwindow.obj : error LNK2019: unresolved external symbol
__imp__UnregisterDeviceNotification at 4 referenced in function "public:
virtual __thiscall Window::~Window(void)" (??1Window@@UAE at XZ)
mainwindow.obj : error LNK2019: unresolved external symbol
__imp__RegisterDeviceNotificationW at 12 referenced in function "private:
bool __thiscall Window::doRegisterForDevNotification(void)"

Looks like for some reason the functions didn't get defined. I am
using MS VC Express 2008 with Windows SDK 6.0A. I tried to add:

DEFINES         += WINVER=0x0501 _WIN32_WINNT=0x0501 _MSC_VER=900

to my .pro file.

So my makefile has:
DEFINES       = -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT
-DWINVER=0x0501 -D_WIN32_WINNT=0x0501 -D_MSC_VER=900 -DQT_DLL
-DQT_XML_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB
-DQT_THREAD_SUPPORT

It didn't resolve the problem. Anyone has any idea?

Thanks,

- Huan T.

On Sat, Jun 13, 2009 at 6:00 AM, Karol Krizka<kkrizka at gmail.com> wrote:
> On Fri, 2009-06-12 at 20:39 -0500, Huan "KDE Zealot" Truong wrote:
>> Hi Scott,
>>
>> Thanks for the suggestions -- I have fixed it and realized that
>> Mingw32 doesn't like many header files in the Windows SDK and
>> generates a lot of warnings (while it works with the Mingw32 API pack,
>> but mingw32 API lacks the stuff I need.) I will try to compile the
>> program with VS2008 to see if it works.
>>
> Yes, MingW32 lacks a lot of useful things on Windows, like DirectX
> support. Recompiling Qt with VC++ tools is the first thing that I do on
> Windows.
>
> --
> Cheers,
> Karol Krizka
>
>> - Huan T.
>>
>>
>>
>> On Fri, Jun 12, 2009 at 6:38 PM, Scott Aron
>> Bloom<Scott.Bloom at sabgroup.com> wrote:
>> > The HEADERS variable is used as a listing of source files that happen to
>> > be headers,..Allowing the build system to find the QObject ones to be
>> > sent to moc.
>> >
>> > Why would you want system headers included?
>> >
>> > Make sure your include path is set correctly, and include it in the
>> > source file
>> >
>> > Scott
>> >
>> > -----Original Message-----
>> > From: qt-interest-bounces at trolltech.com
>> > [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Huan "KDE
>> > Zealot" Truong
>> > Sent: Friday, June 12, 2009 4:29 PM
>> > To: Qt-interest at trolltech.com
>> > Subject: [Qt-interest] Including Win32 SDK header and Lib dir to my
>> > project?
>> >
>> > Hi all,
>> >
>> > I am currently working on a program that needs some native Win32 API
>> > calls. So I changed my .pro file so it looks like this:
>> >
>> > win32:HEADERS += windows.h \
>> >                stdio.h \
>> >                tchar.h \
>> >                dbt.h
>> > INCLUDEPATH += "C:\\Program Files\\Microsoft
>> > SDKs\\Windows\\v6.0\\Include"
>> > LIBDIR += "C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0\\Lib"
>> >
>> > I tried some different combinations of slashes and backslashes but
>> > looks like it didn't work.
>> >
>> > I still see warning messages from the "Compile output" tab of QtCreator:
>> >
>> > WARNING: Failure to find: windows.h
>> > ...
>> >
>> > How do I fix it?
>> >
>> > Thank you very much,
>> > - Huan T.
>> > _______________________________________________
>> > Qt-interest mailing list
>> > Qt-interest at trolltech.com
>> > http://lists.trolltech.com/mailman/listinfo/qt-interest
>> >
>> > _______________________________________________
>> > Qt-interest mailing list
>> > Qt-interest at trolltech.com
>> > http://lists.trolltech.com/mailman/listinfo/qt-interest
>> >
>>
>>
>>
>
>



-- 
Huan T.




More information about the Qt-interest-old mailing list