Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
basik85278
by basik85278. 04/28/24 08:56
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (SBGuy, Quad), 768 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 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,725
Chicago
AndrewAMD Online OP
Serious User
AndrewAMD  Online OP
Serious User

Joined: Feb 2017
Posts: 1,725
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,725
Chicago
AndrewAMD Online OP
Serious User
AndrewAMD  Online OP
Serious User

Joined: Feb 2017
Posts: 1,725
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