Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (Edgar_Herrera, VoroneTZ, Akow), 973 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Better C++ compatibility in Zorro headers #487213
02/11/23 14:00
02/11/23 14:00
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Offline OP
Serious User
AndrewAMD  Offline OP
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
There are many times that I use the Visual Studio debugger, so I include the Zorro headers from a Visual Studio solution.

But I've always had to edit the header files to get them to work, and again and again for every time I get the next beta. Can we permanently make a few minor changes?

contract.c and profile.c:
replace all instances of "string" with "const char*", to prevent error C2440: 'return': cannot convert from 'const char [2]' to 'string'

Re: Better C++ compatibility in Zorro headers [Re: AndrewAMD] #487228
02/14/23 16:42
02/14/23 16:42
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
I had never problems with contract.c and profile.c in my cpp files.

Re: Better C++ compatibility in Zorro headers [Re: AndrewAMD] #487231
02/15/23 14:07
02/15/23 14:07
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Offline OP
Serious User
AndrewAMD  Offline OP
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
Here's an example:
Code
string contractLetter(int Month)
{
	switch(Month) {
	case 1: return "F";
	case 2: return "G";
	case 3: return "H";
	case 4: return "J";
	case 5: return "K";
	case 6: return "M";
	case 7: return "N";
	case 8: return "Q";
	case 9: return "U";
	case 10: return "V";
	case 11: return "X";
	case 12: return "Z";
	}
	return "";
}
Code
1>Y:\ZorroBeta\include\contract.c(313,17): error C2440: 'return': cannot convert from 'const char [2]' to 'string'
1>Y:\ZorroBeta\include\contract.c(313,17): message : Conversion from string literal loses const qualifier (see /Zc:strictStrings)

If you use Visual Studio IDE and make a new project, /Zc:strictStrings is enabled by default. I think it's good practice to keep it enabled.


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1