Forums

General Betting

There is currently 1 person viewing this thread.
Contrarian
22 Oct 10 14:56
Joined:
Date Joined: 19 May 03
| Topic/replies: 1,028 | Blogger: Contrarian's blog
Hi Escapee,

A while ago, you very kindly helped me to sort out a problem I was having with creating the Betfair classes in C++ within Visual Studio.

If you remember, the problem is that when the Betfair web references are imported into the project, the errors:

error C2504: 'com_betfairapi::APIRequest' : base class undefined
error C2504: 'com_betfairapi::RacingSilk' : base class undefined

are generated. You gave me a rough-and-ready solution which involved just removing the references to the base class in the relevant lines of code.

To some extent, this solution does work for me (I have created C++ applications that function with this fix). The problem, though, is that whenever I develop a Windows form-based project in VS C++, after a while the form class cannot be viewed in designer mode (generates an error message if you try to view it). I looked up this error message on the MS forums, and it seems that it may be due to a corrupt reference in the project (which would make sense, given what we know about the errors that are generated when the web references are imported).

I don't suppose you have any idea about how I might fix this problem at a deeper level? I've tried asking the BDP people, but, even though I've been a £200/month subscriber for about 5 years, they say they can't help with queries involving C++.

Thanks in advance.

Contrarian.

Post your reply

Text Format: Table: Smilies:
Forum does not support HTML
Insert Photo
Cancel
sort by:
Show
per page
Replies: 8
By:
Escapee
When: 22 Oct 10 15:22
Whats The Error Message ? Number ?

Off the top of my head, sounds like a resource file curruption problem to me.

What version of Visual studio ?

On VC6++ I used to occasionally get corruption in the .rc file and it would grow from a few hundred K to to a few 10's of mega bytes.
The only way to fix that problem was to delicately edit the crap out.


First off I would try a Build->Clean to see if that cleared the problem without any further investigation needed.
By:
Escapee
When: 22 Oct 10 16:55
Incidently I worked out that this line caused error C2504

public ref class RacingSilkV2 : public com_betfairapi1::RacingSilk {

Because the Class RacingSilk is defined after RacingSilkV2 and V2 is trying to inherit an as yet undefined Class

I moved the entire definition of RacingSilk to above RacingSilkV2 and it compiles.
By:
Contrarian
When: 22 Oct 10 18:29
Hi Escapee,

Sorry for the late response.

Thanks for the tip about moving the base classes. This works fine now (and resolves both of the C2504 errors).

The error message for the Windows form designer failure is:

"Either VCProject or VCCodeModel is not ready yet. Please close designer and try again."

There is no code number.

I'm using VS2008.

Maybe see you at Xmas drinks.
By:
Escapee
When: 22 Oct 10 18:39
This is a CLR Forms Project ?
By:
Contrarian
When: 22 Oct 10 19:07
If that means as opposed to MFC, then, yes (I think!).

It is the sort of project that is created when you click on 'New Project' and then select 'Windows Form Application'.
By:
Escapee
When: 22 Oct 10 19:42
I've managed to recreate your problem !

Its likely that you have some code or class in your Form1.h file outside of the Form1 Class itself.

Unlike older versions of Visual Studio, where all the info about what cotrols you have
on the form/dialog was held in a xxxxxxz.rc file.  The 'Designer' for VS2005+ now creates
what you see 'on the fly' from the content of the corresponding .h file ( i.e. Form1.h )

Being Microsoft, it is easy to confuse the designer.

I recreated the problem by adding a simple structure outside the Form1 class ( the bottom of the file )

ref struct Test {
    int ii;
    int xxx[ 100 ];
};

And there you have your problem.

To cure the problem:
1) remove or comment out the offending code
2) Save the Form1.h file
3) 'X' close the the 'Form1 - [Design]' Tab
4) reopen the Form1 designer by clicking on Form1.h in the 'Solution Explorer'

And Bingo ! you should be back in business.


Let me know if this does or doesn't work.
And if you can't spot the offending code then maybe post your Form1.h file on here and I'll have a gander.
By:
FINE AS FROG HAIR
When: 22 Oct 10 20:06
Seems like Escapee should certainly win the accolade of being probably the most helpful poster on here.
Extremely generous with his time and advice.
Good to read ( though I never understand one bit of it at all ).
By:
Contrarian
When: 22 Oct 10 20:20
Escapee,

Thank you so much. That was exactly the problem: I had a struct defined outside of the scope of the Form.h file.

FAFH - totally agree.
sort by:
Show
per page

Post your reply

Text Format: Table: Smilies:
Forum does not support HTML
Insert Photo
Cancel
‹ back to topics
www.betfair.com