Author Topic: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]  (Read 8128 times)

Arlput

  • Guest
please someone help me to solve this. this is the program
#include<graphics.h>
#include<conio.h>
main()
{
  int gd=DETECT,gm;
  initgraph(&gd,&gm,""); /* initialization of graphic mode */
  circle(150,150,100);
  getch();
  closegraph(); /* Restore orignal screen mode */
}

and this is the error message
mingw32-g++.exe   -c D:\algoritma\coba.cpp -o D:\algoritma\coba.o
D:\algoritma\coba.cpp: In function 'int main()':
D:\algoritma\coba.cpp:6:23: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
   initgraph(&gd,&gm,""); /* initialization of graphic mode */
                       ^
mingw32-g++.exe  -o D:\algoritma\coba.exe D:\algoritma\coba.o   "C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a" "C:\Program Files (x86)\CodeBlocks\MinGW\lib\libgdi32.a" "C:\Program Files (x86)\CodeBlocks\MinGW\lib\libcomdlg32.a" "C:\Program Files (x86)\CodeBlocks\MinGW\lib\libuuid.a" "C:\Program Files (x86)\CodeBlocks\MinGW\lib\liboleaut32.a" "C:\Program Files (x86)\CodeBlocks\MinGW\lib\libole32.a"
Process terminated with status 0 (0 minute(s), 2 second(s))
0 error(s), 1 warning(s) (0 minute(s), 2 second(s))
 
Checking for existence: D:\algoritma\coba.exe
Executing: C:\Program Files (x86)\CodeBlocks/cb_console_runner.exe "D:\algoritma\coba.exe" (in D:\algoritma)

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2847
1) use code tags ( the # symbol in the forum editor) if you post code or logs
2) i see no error, all seems to work as expected (except of the warning, but this has nothing to do with c::b). If the compiled program isn't doing what you want, then you should describe what it does and what it should do (but this would then be not related to c::b and for this, this forum would be the wrong place)

greetings
« Last Edit: May 05, 2015, 10:50:15 pm by BlueHazzard »