简体   繁体   中英

warning: passing argument 1 of … makes pointer from integer without a cast

I have a enum like this:

enum PROCESS_TYPE
{
    PRI_PROC = 0,
    BG_PROC  = 64,
    INT_PROC = 128,
    TI_PROC  = 256,
    PHANTOM  = 512,
    BLOCK    = 1024,
    ZOOMBIE  = 2048,
    ILLEGAL  = 4096
};

I have a function called create_process which has one of the argument as a type of PROCESS_TYPE like this:

create_process(enum PROCESS_TYPE proc_type, const char *name, ...);

When I use the create_process function in this way:

create_process(BG_PROC, "server" ...);

I got error passing argument 1 of 'create_process' makes pointer from integer without a cast . How to solve this? Thank you in advance.

Edit :for the second argument, it's a const char, but it also reports the error of passing argument 2 of 'create_process' makes pointer from integer without a cast

You have to change your function call as create_process(BG_PROC, "server"); instead of create_process(BG_PROC, "server" ...); . For me this following code is working fine..

 enum PROCESS_TYPE {
    PRI_PROC = 0,
    BG_PROC  = 64,
    INT_PROC = 128,
    TI_PROC  = 256,
    PHANTOM  = 512,
    BLOCK    = 1024,
    ZOOMBIE  = 2048,
    ILLEGAL  = 4096
   };

   void create_process(enum PROCESS_TYPE, const char *,...);

   int main() {
        create_process(BG_PROC, "server");
   }

   void create_process(enum PROCESS_TYPE proc_type, const char *name,...) {
     // ...
   }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM