Solved: Building tutorial gives error: ".... cannot execute .... c2.dll"
Having successfully installed Qt-5.1.0 on my Windows 7 (64 bit) machine, I went through the beginner's tutorial:
When I try to build it, I get this error:
:-1: error: D8027 : cannot execute 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\amd64\c2.dll'
The c2.dll file does exist in that path, except that "BIN" is "bin" on my machine. Since Windows is supposed to be case insensitive, I doubt that that's the problem.
Any other ideas?
Thanks for any help!
Are you sure you followed all step correctly, trying to execute a dll doesn't make sense, it should be an exe
I checked each of the five files in my example tutorial against the files in the widgets-example\notepad example, and they're identical. What else might there be to check?
There are actually three identical error lines displayed in the QtCreator window. The display in the "Issues" area is actually "! D8027 ... " with the rest as in my first post.
Being a rank beginner with Qt, I don't know where else to look.
Are you sure your pro file is correct ?
Yes, the pro file is correct because, after your first post, I copied the pro file from the tutorials example to my own directory, and tried to build again. Same errors.
Then can you try with a simple new widget project ?
Where can I find a simple new widget project?
Sorry for the newbie handholding here, but I'm really popping my cherry on this beginner's tutorial stuff. Other beginner tutorials online seem at least as complicated as the one I'm having trouble with.
File menu -> New File or Project -> Qt Widget Project
Use the defaults and you should get a basic project with a widget to show.
I tried to do that, but there is no entry for "Qt Widget Project". There is one for "Qt Gui Application" (which is what the tutorial directs you to create). I did the absolute minimum to get the five necessary files (...h, ...cpp etc.), but added nothing more. I clicked the Build icon, and got the same three identical errors as before.
Next I tried going through another beginner tutorial:
I went only as far as setting up the stuff in the widget.ui file, and then tried building again. I got the same three errors as before.
I'm beginning to think there's something wrong with my Windows 7 installation. Is that possible?
Tonight I installed the 32-bit MinGW version from the Qt Download page. After fooling around with qt-creator for awhile I discovered "Kits". It turned out that Qt found several previous installations. In the Kit selector I found that I could choose various compilers as well as qt-creator binaries, so I chose all of the 32-bit stuff, Qt and MinGW. I was finally able to compile one of the examples.
Then I selected each of the three Microsoft compiler Kit options. Each one gave the same error I mentioned above. Again switching back to the MinGW compiler Kit option gave a compile with no errors.
Again, any clues about the Microsoft errors?
Did you mix the compilers in the kits ?
MinGW Qt projects should only be build with MinGW and the same goes for Visual Studio.
If you have several Qt installed (specially MinGW) you might have trouble. You might consider removing the various installation (also if you have installed your own MinGW) and start from a clean system
Not that I know of. I just did the usual "click on ....exe" and accepted the defaults.
I'm not yet familiar enough with Qt to really understand what you mean by a "MinGW Qt project" or "Visual Studio" project. The only thing that might be installed with respect to Visual Studio, as far as I know, is whatever stuff comes along with a stock Windows 7 installation. I suppose that has to do with "MSCV"?
After you comment on the above, I'll remove all the Qt stuff and reinstall the 32-bit MinGW version.
If that works, it still remains: what's going on with the errors I described in my original post? They're apparently related to an MSCV-related version of Qt.
By MinGW project I mean a Qt project configured to use the MinGW version of Qt.
AFAIK, there's nothing Visual Studio related in a stock Windows 7.
The error on your first post seems to indicate that you were trying to build your project with some configuration for Visual Studio.
[quote author="SGaist" date="1374762381"]By MinGW project I mean a Qt project configured to use the MinGW version of Qt.[/quote]
Is there anything more to that than just selecting the MinGW C++ compiler in a Kit? Again, I noticed that it's possible to select from a list of available compilers.
[quote]AFAIK, there's nothing Visual Studio related in a stock Windows 7.[/quote]
Ok. Then what is the c2.dll thing that the error message in my original post is complaining about? That dll really does exist (along with tons of other stuff) in the Windows 7 diretories.
[quote]The error on your first post seems to indicate that you were trying to build your project with some configuration for Visual Studio.[/quote]
That makes sense. However, since I did not select any configuration, but went with all of the defaults, it follows that Qt itself is trying to build that way. But I thought that any precompiled version comes with an appropriate compiler. For example, one precompiled version that I installed is from the Downloads page:
There is no indication in any documentation I've seen that you need a separate C++ compiler installation, which leads me to conclude that a compiler comes with the download. If the default is to use a compiler somewhere else in the system, such as invokes that offending c2.dll file, then something is wrong.
Is what I've said above correct? Obviously I'm missing something.
The MSVC downloads are to be used with Visual Studio's compilers, these where never bundled. Visual Studio is a product that comes from Microsoft in several flavors (not only in the numbers)
Then came MinGW, this one is included with the MinGW installers.
So you have a classic case of Visual Studio installation missing, either grab it (in this case VS2012) from Microsoft's site or use the MinGW installer and no need for VS
I see. Well then, I'll give that a try.
Do you have a suggestion about exactly which flavor of Visual Studio to use? I have no opinion since I'm brand new to compiling stuff on Windows 7. Is the "VS2012" that you mention the same thing as I list below?
Googling "microsoft visual studio" yields several options:
Buying various flavors of Visual Studio 2012 for as much as $4249.
Getting a free version (but you have to register with Microsoft), such as:
Visual Studio Express 2012 for Windows Desktop
Visual C++ 2010 Express
Visual Studio 2010 Express All-in-One ISO
Are there other options?
As for MinGW, I found that there are 32-bit and 64-bit versions available that have nothing to do with Qt. Will these work with Qt?
As I mentioned, I successfully installed and ran the 32-bit MinGW version of Qt, obtained from the Qt-project Download page. I thought that, because I have a 64-bit system with lots of memory, a 64-bit MinGW version of Qt would be better, and I found a precompiled version mentioned on this thread:
A maintainer of the MinGW-builds project has provided a precompiled version of Qt 5.1.0 with Qt Creator 2.8.0-RC for MinGW 64-bit:
This installed and ran successfully, but contains no tutorial material -- which is what I need right now.
Any comments about 32 versus 64-bit MinGW versions?
Finally, I understand that MinGW is a port of GNU GCC to Windows. Is there a way to get the full-blown GCC compiler on Windows, or is that a lost cause and one must use MinGW?
Thanks so much for your help.
Since you downloaded the 2012 installer, you'll need the 2012 Visual Studio, but there is an Express edition that is free (2012, not 2010 or change the installer)
These will BUT don't try to install multiple version of MinGW, they might interfere with each other and you'll loose a lot of time sorting out things. Use the one bundled with Qt and you should be fine.
Since you want to learn the ropes, you don't need to worry for the 64 vs 32bit at this time. Just get the official 32bit which contains all what you need to start.
AFAIK that's what MinGW is, gcc for windows (even if there's min in the name)
I removed all QT versions and anything I could find having to do with Visual Studio. Apparently I had installed a beta of Visual Studio 11 a year ago, never used it, and then forgotten it.
Anyway, I successfully installed and ran some tutorials on the 32-bit MinGW Qt version.
Great that you found out !
Then you can update the thread's title to solved :)
Happy coding !