PDA

View Full Version : QT/Win 4.1.1 with VisualStudio2005 Newbie



skaiser
18th March 2006, 02:46
I am a total newbie. Today I installed:

Visual Studio 2005 Standard Edition
Qt 4.1.1 (qt-win-commercial-4.1.1-vs2003)
Visual Studio Integration (qt-vsintegration-1.1.1)

Since the installation instructions on the Trolltech website started off saying to change the license filename to ".qt-license" (which makes no sense to me in a windows environment), I ignored all the installation notes and just let the installer wizards chun away.

Things seemed to go pretty well. I found the path environment variables setup automatically even though I was supposed to manually set it, the license filename unchanged seems ok, etc.

So I happily launched Visual Studio, and was greeted with lots of Qt help, and a nice introductory tutorial project called "addressbook". Yeay! Created the "addressbook" project as instructed. Yeay! But it does not compile. Rats! Output window shows the following:

Moc'ing addressbook.h...
Uic'ing addressbook.ui...
Compiling...
moc_addressbook.cpp
c1xx : fatal error C1083: Cannot open source file: '.\GeneratedFiles\debug\moc_addressbook.cpp': No such file or directory
main.cpp
d:\workdirs\visualstudio\projects\addressbook\addr essbook\addressbook.h(5) : fatal error C1083: Cannot open include file: 'ui_addressbook.h': No such file or directory
addressbook.cpp
d:\workdirs\visualstudio\projects\addressbook\addr essbook\addressbook.h(5) : fatal error C1083: Cannot open include file: 'ui_addressbook.h': No such file or directory
Generating Code...

I attach the entire build log as a text file for more info. Any advice to a newbie trying to get started? Seems like "moc.exe" never generated "moc_addressbook.cpp'" for reasons I assume to be related to environment variables or directory settings.

Steve

zlatko
22nd March 2006, 08:17
Problem witn failed path


fatal error C1083: Cannot open source file: '.\GeneratedFiles\debug\moc_addressbook.cpp': No such file or directory


Look in properties of your *.ui files

skaiser
22nd March 2006, 19:21
thanks zlatko for your suggestion.

I looked at the properties for addressbook.ui, and it seems in order (as far as I can tell). I think its worse than just a bad reference to a valid file-- there was no file generated at all. moc_addressbook.cpp was not generated, nor was ui_addressbook generated.

If I run moc.exe from the command line, I get this error:

"This application has failed to start because MSVCP71D.dll was not found. Re-installing the application may fix this problem."

I may be chasing shadows, but I think that's the problem. The ui_ and moc_ files were never generated because the apps that are supposed to create them never get started.

But how to get MSVCP71D.dll, or who was supposed to install it, is a mystery to me.

Steve

skaiser
22nd March 2006, 22:44
I am optimistic I solved my problem.

I got Qt working by adding some missing dll's to the Qt bin directory. I figured out that when I manually run moc.exe or uic.exe from the command line, I get an errors from windows saying it's missing MSVCP71D.dll and MSVCR71D.dll. So taking this as a clue, I manually downloaded these dll's from some Google'd site and now Qt seems happy.

http://www.dll-files.com/dllindex/dll-files.shtml?msvcp71d
http://www.dll-files.com/dllindex/dll-files.shtml?msvcr71d

So looks like I broke through the wall. I am at a loss for what I did, or why this works, but onward and upward!

If anyone is listening, I would be interested to learn the results of you searching for these dll's on your hard drives, and see if/where they are in your system. But hopefully this dll hell is behind me and knowing where they are supposed to go is an academic issue.

Steve

Brandybuck
23rd March 2006, 00:40
Those files should be a part of Visual Studio 2005. Sounds like when you installed VS2005 you didn't have it automatically set the environment variables for you. Without them the system can't find the libraries.

skaiser
23rd March 2006, 01:45
I agree they should be part of Visual Studio 2005.

But after installing Visual Studio 2005 fresh from the box, the dll's did not exist anywhere on my hard drive. It is not an issue of setting the correct environment variables-- the dll's Qt moc.exe and uic.exe require are physically not present after a fresh Visual Studio 2005 installation.

The Visual Studio installer does not give any option for setting environment variables. The installation process is a highly automated procedure.

My only guess is I purchased the academic version of Visual Studio 2005, which may be denuded by Microsoft for economic reasons. Trolltech may assume everybody has the full blown enterprise architect superhero dotwhizbang version. Also, perhaps the educational version of Qt I got licensed for is strange (moc and uic would require debug versions of these dlls?). I am only guessing.

Steve

Brandybuck
23rd March 2006, 04:31
It sounds like you have a horribly broken Visual Studio. Your missing files are *required* for most VC++ programs. Maybe you have a VB or .NET only version?

You set environment variables in Windows in the control panel (somewhere) and not in Visual Studio.

Anyway, since it doesn't sound like you're using Qt commercially, have you considered the free Open Source version? It comes with the free MingW (gcc) compiler. Supply a text editor (like xemacs, nano, vim, etc), and you have all the tools you need.

ChristianEhrlicher
23rd March 2006, 07:53
msvcrt71d.dll is *not* from msvc2005 but from msvc2003.net (msvc2005 has msvcrt80d.dll)
You build your moc.exe with msvc2003.net in debug mode (don't know how you did this). Rebuild your qt-lib with msvc2005 and it should work fine.

Brandybuck
23rd March 2006, 09:06
My pardons.

skaiser
24th March 2006, 03:26
Thanks Christian for a mighty helpful post! Man the light bulbs came on.

I never built moc.exe-- it came with the Qt installation. So now things are clearer-- Trolltech's qt-win-commercial-4.1.1 installer comes with pre-built binaries, and Trolltech built them with .NET 2003 in debug mode.

This makes sense, since the installer file is named "qt-win-commercial-4.1.1-vs2003.exe". heheh. As a newbie, I failed to recognize the subtle difference and what that meant for VS 2005.

Also, one installer doc does say that I am supposed to configure and build the package first with nmake. So as you suggest, I guess I should figure out how to do that and see what happens.

Thanks Brandybuck for chiming in. I have considered the Open Source version, but I'm very keen to get the VisualStudio integration thing happening. If it doesn't work right, then I'll drop back to the Open Source and probably try a KDE / KDevelop environment. Got a big project ahead and want to get the best tools I can up front here before settling in.

Steve