[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3525
  • Last Modified:

Compiling QT Demo Media Player VS 2008

I'm new to C++ and QT. I downloaded and installed qt-win-eval-4.5.0-vs2008.exe. Then I downloaded the Visual Studio 2008 plug-in (qt-vs-addin-1.0.0-rc1.exe).

I did hello world and it worked (once I googled a bit and realized that the HW example was from QT 3). Then I did the example in chapter 2 and it worked. And I got greedy.

I loaded Media Player (C:\Qt\4.5.0\demos\mediaplayer) into Visual Studio 2008. I seem to have all the files. When I compile, I get

Error      1      error LNK2019: unresolved external symbol _main referenced in function _WinMain@16      qtmaind.lib      MediaPlayer

So I went to the linker and told it to ignore all default librarys (not sure that was the right thing, /NODEFAULTLIB), and recompiled, and it actually looks better even though the number of errors has gone up:

Error      1      error LNK2019: unresolved external symbol ___security_cookie referenced in function "public: __thiscall MediaPlayer::MediaPlayer(class QWidget *,class QFlags<enum Qt::WindowType>)" (??0MediaPlayer@@QAE@PAVQWidget@@V?$QFlags@W4WindowType@Qt@@@@@Z)      mediaplayer.obj      MediaPlayer


My question is: Was I supposed to compile QT (I did download the open source -- qt-sdk-win-opensource-2009.01.1.exe) under Visual Studio 2008? Or did the plugin installation take care of that?

Thanks,
JJ
0
jj_30
Asked:
jj_30
  • 5
  • 2
1 Solution
 
jj_30Author Commented:
Also, the QT modules I picked: Core Library, Gui library, openGL library, SVG library, and Qt3 Support Library (QT project settings -- QT Modules).
0
 
jj_30Author Commented:
Ok ... well... after all day, I got it down to 1 error.

Error      1      error PRJ0019: A tool returned an error code from "Rcc'ing mediaplayer.qrc..."      MediaPlayer      MediaPlayer


Anyone?
0
 
itsmeandnobodyelseCommented:
The .qrc file is a QT resource file which needed to be interpreted by a QT tool installed in Visual Studio.

I would guess there is still an installation missing or the mediaplayer.qrc requires  a different version of the tool.

You may check the following page http://filext.com/file-extension/QRC for a proper installation of that tool.

You also may check whether the mediaplayer.qrc is available in your project and whether the folder where it resides is one of the known project folders. Also check the build step defined for that file (you should find the mediaplayer.qrc  somewhere in the project tree - if not that might be the issue - right-click and choose properties to find out what build-steps were defined). Here the paths to tool and file should be known in the standard directories of Visual Studio (Tool - Option - Projects - VC Directories ...) or in the project specific 'Additional Directories' for includes (preprocessor) and resources.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
jj_30Author Commented:
Ok, here is what I did. I compiled QT 2009.01 as per:

http://rajorshi.net/blog/2009/01/using-qt-with-msvc-express-2008/#comment-1219

And was able to compile the project via 2008 command line 1) qmake -project 2) qmake mediaplayer.pro 3) nmake (also as per above link).

But I am still not able to compile / run in Visual Studio (now using VC++ 2008 Express).

It says

RCC mediaplayer.qrc
C:\Qt\2009.01\qt\\bin\rcc.exe: File does not exist 'mediaplayer.qrc'
Project : error PRJ0019: A tool returned an error code from "RCC mediaplayer.qrc"

Which I KNOW is simple.
0
 
jj_30Author Commented:
I know someone out there knows this.

The file is in the Visual C++ 2008 Express project already. So why would it say that it isn't there?

How do I get this code to be accepted by the Visual Studio 2008 compiler?

I'm perplexed here. I joined EE because people always had answers to my problems. Now ... nothing!  It can't be just a bunch of .NET people here. There have to be some people that know C++.

There is at LEAST one person who is reading this who knows what my problem is!
0
 
itsmeandnobodyelseCommented:
>>>> The file is in the Visual C++ 2008 Express project already.
The C:\Qt\2009.01\qt\\bin\rcc.exe has no access to the VC project data. It needs a full path to the file or needs to have the mediaplayer.qrc in the current directory which most probably is the project directory.

Try to find out where the rcc will be invoked. It probably is in the pre-build step of the mediaplyer.qrc (right-click on the file in the project tree and choose properties). Here try to add a path to the file (no spaces or put all in "").

0
 
jj_30Author Commented:
Thank you itsmeandnobodyelse, but why did it take an entire month for someone to tell me this? :(

Right-clicking the actual file in the project tree (mediaplayer.qrc), in the 'Custom Build Step'  (General tab), I changed it to

$(QTDIR)\bin\rcc.exe -name mediaplayer c:\qt\2009.01\qt\demos\mediaplayer\mediaplayer.qrc -o debug\qrc_mediaplayer.cpp

With the full path of mediaplayer.qrc in there, it works great now.

That being said, I sort of lost the political battle for QT (but not the war), and we're stuck with microsoft again.  

Thanks,
JJ
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now