Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Borland C++ 6 and MFC

Status
Not open for further replies.

ZillionDollarSadist

Programmer
Apr 28, 2005
5
0
0
IT
Hello, I'm facing this problem.
I'm writing an application featuring video capture. My videocapture board has its drivers and sdk, written with MFC for Visual c++ 6. Now I have to use this sdk's functions to correctly initialize the board, and I have to do this in Borland C++ 6.
The DLLs are all installed, and the crucial part is including a header called "averapi.h" with no errors, because when I do it, and call a function, I recieve this: [Linker Error] Unresolved external 'AVER_PaintOverlay' referenced from D:\PROGRAMMI\BORLAND\CBUILDER6\PROJECTS\LIVEVID\MAIN.OBJ

Any idea? Thanks.
 
When I see that error, it usually means I either forgot to include a file or I need to include some namespace. MFC will work with BCB if you are using the source code, which it sounds like you are.



James P. Cottingham
-----------------------------------------
[sup]To determine how long it will take to write and debug a program, take your best estimate, multiply that by two, add one, and convert to the next higher units.[/sup]
 
Thanks. I still have problems, so I'm posting the thing I need to have linked properly - how would you link it?

Code:
//  Module:
//
//    AVERAPI.H
//
//  Abstract:
//
//    Header file for AVERTVNT.DLL
//
/////////////////////////////////////////////////////////////////////////////

// AVERAPI.H

#ifdef __cplusplus

#ifdef	_AVER32_
#define AVERAPI extern "C" __declspec(dllexport)
#else
#define AVERAPI extern "C" __declspec(dllimport)
#endif

#else

#ifdef	_AVER32_
#define AVERAPI __declspec(dllexport)
#else
#define AVERAPI __declspec(dllimport)
#endif

#endif

#ifndef __VIDDEFS_H
#define __VIDDEFS_H
// Type: Connector
// Purpose: Defines a video source
typedef enum { ConError = 0, ConSVideo = 1, ConTuner = 2, ConComposite = 3, ConCamera = 4 } Connector;

// Type: VideoFormat for BT848, BT848A
// Purpose: Defines video format
typedef enum {	VFormat_AutoDetect = 0,
		VFormat_NTSC = 1,
		VFormat_NTSC_J = 2,
		VFormat_PAL_BDGHI = 3,
		VFormat_PAL_M = 4,
		VFormat_PAL_N = 5,
		VFormat_SECAM = 6,
		VFormat_PAL_NC = 7 } VideoFormat;
#endif // __VIDDEFS_H

#ifndef __COLFRMAT_H
#define __COLFRMAT_H
// Type: ColorFormat
// Purpose: Enumerates all possible color formats that BtPisces can produce
typedef enum
{ CF_RGB24 = 0, CF_RGB8 = 1 } ColFmt;
#endif // __COLFRMAT_H

#ifdef __cplusplus
extern "C"
{
#endif

class CDSControl;

CDSControl	*m_lpDSControl;
int			m_CurConn;
ColFmt		m_CurCFmt;
RECT		rcVideoWnd;
BOOL		bIsSart = FALSE;
HWND		hwndC;

BOOL		bSave = FALSE;
BOOL		bFreeze = FALSE;
BOOL	    bHasTmp = FALSE;
BOOL		bGetBmp = FALSE;

char		szGetBmp[255];

void		ColorConvert();

AVERAPI BOOL WINAPI AVER_Init(HWND hwnd);
AVERAPI BOOL WINAPI AVER_Close();

AVERAPI BOOL WINAPI AVER_PaintOverlay(LPRECT lprect);
AVERAPI BOOL WINAPI AVER_PaintPreview(HDC hdc);
AVERAPI BOOL WINAPI AVER_StopOverlay(LPRECT lprect = NULL);

// Video source
AVERAPI int WINAPI AVER_GetVideoSource();
AVERAPI BOOL WINAPI AVER_SetVideoSource( int conn );

// Video system
AVERAPI int WINAPI AVER_GetVideoFormat();
AVERAPI BOOL WINAPI AVER_SetVideoFormat( int aFormat );

// Color adjustment
AVERAPI int WINAPI AVER_GetBrightness();
AVERAPI int WINAPI AVER_GetContrast();
AVERAPI int WINAPI AVER_GetHue();
AVERAPI int WINAPI AVER_GetSaturation();
AVERAPI BOOL WINAPI AVER_SetBrightness(int nValue);
AVERAPI BOOL WINAPI AVER_SetContrast(int nValue);
AVERAPI BOOL WINAPI AVER_SetHue(int nValue);
AVERAPI BOOL WINAPI AVER_SetSaturation(int nValue);

//Color Format
AVERAPI int WINAPI AVER_GetColorFormat();
AVERAPI BOOL WINAPI AVER_SetColorFormat(int m_ColFmt);

//Set Surface Configuration
//AVERAPI BOOL _cdecl AVER_SetSurface(BOOL bFlag);

AVERAPI BOOL WINAPI AVER_SaveBMPFile();
AVERAPI BOOL WINAPI AVER_CaptureSequence(LPSTR str);
AVERAPI BOOL WINAPI AVER_GetBMPFile(LPBITMAPINFOHEADER lpvBMI);

#ifdef __cplusplus
}
#endif
 
You've included AVERAPI.h in your header, right? (#include <AVERAPI.h> or #include "AVERAPI.h")

Your call may have to be AVERAPI::AVER_PaintOverlay(...) or something like that.


James P. Cottingham
-----------------------------------------
[sup]To determine how long it will take to write and debug a program, take your best estimate, multiply that by two, add one, and convert to the next higher units.[/sup]
 
Thanks, but after an intense afternoon of netsurfing I discovered this: BCB and VC++ use different library formats! So, in cases like this, you have to use the coff2omf utility, included in the /bin directory of the Borland Builder.

Like this:
coff2omf problematic.lib problematic2.lib

Then you delete the first one and rename the second one, and it all works.

I write since it may be useful for someone else.
Thanks anyway James!
 
Oddly enough, I was going to suggest that but decided to see where this route took you. [blush]

James P. Cottingham
-----------------------------------------
[sup]To determine how long it will take to write and debug a program, take your best estimate, multiply that by two, add one, and convert to the next higher units.[/sup]
 
I have new problems now (they never end)...
Now that the .lib has been convertend in omf and loaded, when my app makes a call to the lib's functions, it gives me a nasty EAccessViolation:

"Access violation at address 10003298 in module 'AVERAPI.DLL'. Read of address 00000000."

What the...
Thanks!
 
These are tough to find and fix. I'll look around and see what I can find.



James P. Cottingham
-----------------------------------------
[sup]To determine how long it will take to write and debug a program, take your best estimate, multiply that by two, add one, and convert to the next higher units.[/sup]
 
Not to point out the obvious but... did you call Init() first? :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top