PDA

View Full Version : New user: Compiler error on initial project setup



bitsnbites13
January 27, 2005, 17:01:41
After I made the project settings as per the example for VC.NET, I have the following several errors which all complain about the same fault, in the same header file. I am only at the "Instancianting the Grabber" part of the example where you compile to check the project settings changes.

Compile error:
c:\Program Files\The Imaging Source Europe GmbH\IC Imaging Control 2.0\ClassLib\include\IVCDProperty_inl.h(230): error C2558: class 'smart_com<TComObj>' : no copy constructor available or copy constructor is declared 'explicit'
with
[
TComObj=DShowLib::IVCDPropertyInterface
]

Any suggestions?

Thanks

bitsnbites13
January 27, 2005, 19:03:45
I have VC6 and VC7.NET. The VC6 examples compile and run without any problems. However ALL the VC7 samples produce the same compile error as in the manual steps I did in making the example (listed in my previous post). The VC7 example solution files work only for VC7.10 as I have VC7.0. (I converted the dsp files to vc7).

Hope this helps to find the problem.

qwda
January 31, 2005, 14:42:26
I've had no major issues including in native C++ code.
Because of my compiler settings, however, I have errors aborting the compile on any warnings as suggested in John Robbins' excellent book on debugging.
Therefore had to wrap the header thus:



#include "oleauto.h" // needed for SysAllocString and SysFreeString in THEIR header!!!
#pragma warning( push, 1 ) // fails on C4251 despite ( disable : 4251 ) on levels 2, 3 and 4!
#pragma warning( disable : 4189 ) // local variable is initialized but not referenced
#pragma warning( disable : 4100 ) // unreferenced formal parameter
#pragma warning( disable : 4251 ) // ... needs to have dll-interface to be used by clients of class ...
#include "tisudshl.h"
#pragma warning( pop )
using namespace _DSHOWLIB_NAMESPACE;


also noticed a potential code error in the callback sample which I've not had time to check properly.

samples\vc7\common\SetupDevice.cpp



if ( pVidCapDevList == 0 || pVidCapDevList->empty() )

umm, surely if that's a null pointer then the call to empty() would fail anyway?

I'm no C++ genius - but I think that's a pointless statement!

Q :)

Stefan Geissler
January 31, 2005, 15:32:07
Hello,

If you use .NET 7.0, then you can not avoid an error. It is an error in the STL. .NET 7.0 is not supported.

The
if ( pVidCapDevList == 0 || pVidCapDevList->empty() )
works as follows:
If pVidCapDevList is 0, the second boolean operation after the OR is not executed any more. The second operation after the OR is only executed, if pVidCapDevList is not 0. This is named "short circuit" evaluation.

qwda
January 31, 2005, 18:15:50
Many thanks. I'll have to set myself up a little compile test to prove that for myself.

I am the man who encloses everything in brackets in my code...
Obfustication? - don't know the meaning of the word!!! ;)