2016-12-5 16:17:09
----------------------------
In the development of the CTP system under CentOS, in the process of introducing C + + program, compile (g++ * * * *), there are the following tips
"1" testmdapi.cpp:15:45: warning:deprecated Conversion from string constant to ' char* ' [-wwrite-strings]
Char *ppinstrumentid[] = {"cu0907", "cu0909"}; Market Subscription List
^
TESTMDAPI.CPP:15:45: warning:deprecated Conversion from string constant to ' char* ' [-wwrite-strings]
Although there is such a hint, but it is still valid C + + code, because the written char* is a C-style string, so g++ does not recognize
You can choose to add when compiling: g++-wno-write-strings text.cpp//Ignore warning ...
Actually, it's not very safe.
"2" testmdapi.cpp:21:15: Error: ':: Main ' must return ' int '
void Main (void)
Not a problem with the code, but a compiler problem
The C language standard allows the main function to be void type
Instead, the standard for C + + must be of type int
However, many Ides or compilers do not necessarily keep the C + + standard, such as vs
C + +: warning:deprecated conversion from string constant to ' char* ' [-wwrite-strings]