How to use execv() without warnings?

前端 未结 6 1850
半阙折子戏
半阙折子戏 2021-01-03 07:46

I am working on MacOS-X Lion with GCC 4.2. This code works, but I get a warning I would like fix:

#include 
main()
{
    char *args[] = {\"/b         


        
6条回答
  •  梦谈多话
    2021-01-03 08:21

    You are converting a string constant to a mutable character pointer, change using an implicit cast, the compiler is warning you that newer versions of the language will not allow this cast.

    When defining a string litteral c++ understands it to mean a constant character array you have defined it as a mutable character array, change your code accordingly.

提交回复
热议问题