How to define/use CBaseVideoRenderer-constructor - c++

I want to use the C++-Class CBaseVideoRenderer. Which file do I need to include to get its constructor?
I have included renbase.h, but there's only the declaration. I have included strmbase.h and any other errors regarding this class vanished but the one for the missing constructor.
renbase.cpp seems to have a constructor but I cannot just include it without errors.
So, do you know which files I need?
Im Using embarcadero's C++-Builder from XE2 16.
EDIT: I want to use this class:
CBitmapRenderer::CBitmapRenderer(
TCHAR *pName,
LPUNKNOWN pUnk,
HRESULT *phr
)
: CBaseVideoRenderer(CLSID_BitmapRenderer,pName,pUnk,phr)
, m_InputPin(NAME("Video Pin"),this,&m_InterfaceLock,phr,L"Input")
{...
With this code:
CBitmapRenderer *m_pSnapshotter = new CBitmapRenderer( _T("Bitmap renderer"), NULL, &hr );
Which leads to an Link-error:
[ILINK32 Fehler] Error: Nicht auflösbares externes 'CBaseVideoRenderer::CBaseVideoRenderer(_GUID&, wchar_t *, IUnknown *, long *)' referenziert von C:\USERS\JULIAN\DESKTOP\PROGRAMM\WIN32\DEBUG\TESTRAUSCHEN.OBJ
That I know comes from a missing definition for the constructor.
EDIT2:
I have now included all files within baseClasses-direcory and the compiling is sucessful(without errors). However, when I try to run the application, I get the message "strmbase.dll" is missing. Install this program again"
But I never had a strmbasd.dll. I have a strmbasd.lib. That's the result when trying to compile the baseclasses-project with visual studio in debug-Mode.
Does anybody knows where to get this dll or how to use the lib instead?
Regards,
Julian

Related

Calling external function, unable to specify types C++/MVS

I am following this tutorial for accessing functions stored in a 3rd party .dll. (For full disclosure, I am not trying to hack a video game, I just need to use the same tools).
I'm using Visual Studio 2017 (v141) and my current code looks like this:
if (HMODULE const hLib = LoadLibraryA(PATH_TO_LIB)) {
typedef IServer(__cdecl * _Create)(char* version);
_Create Create_addr = (_Create)GetProcAddress(hLib, "Create");
}
I am trying to call the function IServer Create(char* version) stored in the .dll, the type IServer is also defined in the .dll. After running dumpbin I can confirm that the function is exported correctly.
I have also imported the header file containing the IServer definition.
The issue is that, according to visual studio:
In lieu of __cdecl * it "expected a type specifier"
At (char* GameServerInterfaceVersion), it claims "a function returning function is not allowed"
On the last line, _CreateGameServer is apparently an "unidentified identifier"
I believe I have followed the tutorial to the letter and can't see what I'm doing wrong.
How can I get VS to recognize these types?
You have to define IServer first and then the errors will disappear

error c2065 :'LONG64' : undeclared identifier

I have a c2965 problem that I need to get solved. I am new to c++ and when I try to compile my script I get the following error.
error c2065:'long64' : undeclared identifier
on the line
long64 *x, *y;
I am not sure what have caused this and it seems that this is a relatively uncommon issue. I work on a 64bit system and uses a 64bit compiler installed in visual studio 2008.
If anyone know the cause, please answer this. Thanks beforehand
The error message is clear enough: the compiler does not see the definition of name long64, It is possible that the corresponding definition is present in some header file that you forgot to include in the module.
You can try to include header <cstdint> and use type int64_t instead of long64

Compilation error when using LuaPlus

I found a nice tutorial on how to implement LuaPlus into an C++ Project using Visual Studio 2010.
http://www.zynox.net/luaplus-1-compiling-basic-usage/
But I can't get it to work because of some error messages..
mainproject\main.cpp(51): error C2664: ‘GetCurrentDirectoryW’ : cannot convert parameter 2 from ‘char [260]‘ to ‘LPWSTR’
50. char pPath[ MAX_PATH ];
51. GetCurrentDirectory(MAX_PATH,pPath);
52. strcat_s(pPath,MAX_PATH,"\\test.lua");
I tried to use TCHAR instead of char, but then it says:
no instance of overloaded function “strcat_s” matches the argument list
So for testing purposes I just deleted these three lines and replaced them with a static path:
const char* pPath = "C:\\Users\\fancyBubble\\Documents\\Visual Studio 2010\\Projects\\LuaPlusTutorial\\MainProject\\test.lua";
and now I get:
fatal error LNK1104: cannot open file ‘..\Debug\LUAPlus.lib’
I'm absolutely clueless how to fix this.
I even tried to use the same version of LuaPlus that the tutorial-creator probably used, but the error messages didn't go away.
I don't really know what I did wrong, but the admin uploaded the whole solution:
http://www.zynox.net/?wpfb_dl=3
Using this combined with greatwolf's comment it works great. :)

OpenCV 2.3 with Qt 4.3.7

I have successfully build and ran both Qt 4.3.7 and OpenCV 2.3 with Qt enabled. When I start a window using:
cvNamedWindow( "video", 0 );
I successfully load a full Qt interface! wonderful :)
However!! when I use the command
void callbackButton(int state, void* userdata){
int x;
x=3;
}
cvCreateButton(nameb2,callbackButton,nameb2,CV_CHECKBOX,0);
I get the error message
error LNK2001: unresolved external symbol _cvCreateButton
I don't understand as the Qt interface already has lots of buttons on it? could someone please explain what I am missing from the include that could cause this?
Thanks!
You use the wrong parameters for to call to cvCreateButton. According to the documentation here the signature of the function is
cvCreateButton(const char* button_name CV_DEFAULT(NULL), CvButtonCallback on_change CV_DEFAULT(NULL), void* userdata CV_DEFAULT(NULL), int button_type CV_DEFAULT(CV_PUSH_BUTTON), int initial_button_state CV_DEFAULT(0)
and sample calls are:
cvCreateButton(NULL,callbackButton);
cvCreateButton("button2",callbackButton,NULL,CV_CHECKBOX,0);
cvCreateButton("button3",callbackButton,&value);
cvCreateButton("button5",callbackButton1,NULL,CV_RADIOBOX);
cvCreateButton("button6",callbackButton2,NULL,CV_PUSH_BUTTON,1);
and the declaration of the callback function has to be:
CV_EXTERN_C_FUNCPTR( *CvButtonCallback)(int state, void* userdata));
You get a linking error and not a compiler error because cvCreateButton has extern "C" linkage - which means that parameters cannot be checked at compile time.
I solved this issue by calling the function cv::createButton instead of cvCreateButton (which is if I am correct the way to call methods in OpenCV2).
The third argument must be a void*. Change to:
cvCreateButton(nameb2,callbackButton,NULL,CV_CHECKBOX,0);
and it will work.
Edit
The statement above was given an error.
The third needed argument is a "void *" - this is compatible with anything and thus neither C nor C++ should have a problem with what you were providing. You can not raise a linker error with that.
The only reason a linker error can be raised by coding is when you don't use prototypes (forgot to use the header file) in C++ and then C++ creates a mangled name on its own that wont be part of any library. In such a case the compiler will first tell you with a warning at compile time that you are missing the prototype (for C and C++) - and then the linker will probably raise an error (for c++ only).
If you don't see a prototype warning from the compiler then that is not your problem.
This is a linking error.
Try to add the opencv .lib file (or files) to the project libraries path.
This may help : VS2010 OpenCV.
Edit
Refined problem: Even if adding any OpenCV libary to your project the linking will fail.
Reason: The symbol is often simply not there in the libraries.
Solution: You have to change a few settings and compile them on your own.
See also: openCV 2.2 createButton LNK 2019 error in Visual Studio 2010

Unresolved externals error during compilation

I am getting two unresolved externals error while trying to compile the following c++ program in Visual Studio 2010-
http://codepad.org/5ZS4gtfP
I tried cross checking everything but cant seem to find the problem. Can someone plz compile it in VS 2010 and try to find out the solution?
For a start, conio.h is not standard C or C++ - it tends to be found in code written for the Turbo C/C++ products, a particular favourite of Indian universities.
And they invariably use it just so they can call getch when there's a perfectly adequate getchar in the standard :-)
As to the index variable, it's probably already defined in one of the headers.
Line 18: error: conio.h: No such file or directory:
Try to include <conio.h> instead of "conio.h".
Line 25: error: 'unsigned int index' redeclared as different kind of symbol:
It could be that one of the headers you're including already declares index. Try to rename it to see the difference - or better yet don't use a global variable at all.