Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/60.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C “的任务配置”;“保持清洁”;不';t在Visual Studio 2017工作_C_Visual Studio_Makefile - Fatal编程技术网

C “的任务配置”;“保持清洁”;不';t在Visual Studio 2017工作

C “的任务配置”;“保持清洁”;不';t在Visual Studio 2017工作,c,visual-studio,makefile,C,Visual Studio,Makefile,我写了一个简单的程序: void nothing(); CC = gcc CC_FLAGS = -g EXEC = run SOURCES = $(wildcard *.c) OBJECTS = $(SOURCES:.c=.o) $(EXEC): $(OBJECTS) $(CC) $(OBJECTS) -o $(EXEC) %.o: %.c $(CC) -c $(CC_FLAGS) $< -o $@ clean: rm

我写了一个简单的程序:

void nothing();                   
CC = gcc
CC_FLAGS = -g
EXEC = run
SOURCES = $(wildcard *.c)
OBJECTS = $(SOURCES:.c=.o)

$(EXEC): $(OBJECTS)
    $(CC) $(OBJECTS) -o $(EXEC)

%.o: %.c
    $(CC) -c $(CC_FLAGS) $< -o $@

clean:
    rm -f $(EXEC) $(OBJECTS)
{
  "version": "0.2.1",
  "tasks": [
    {
      "taskName": "BUILD",
      "appliesTo": "/",
      "workingDirectory": "${workspaceRoot}",
      "command": "make",
      "type": "default"
    },
    {
      "taskName": "CLEAN",
      "appliesTo": "/",
      "workingDirectory": "${workspaceRoot}",
      "command": "make clean",
      "type": "default"
    }
  ]
}
'"make clean"' is not recognized as an internal or external command,      
operable program or batch file.                 
main.c:

#include "main.h"

void nothing(){}

int main(){
  nothing();  
  return 0;
}    
void nothing();                   
CC = gcc
CC_FLAGS = -g
EXEC = run
SOURCES = $(wildcard *.c)
OBJECTS = $(SOURCES:.c=.o)

$(EXEC): $(OBJECTS)
    $(CC) $(OBJECTS) -o $(EXEC)

%.o: %.c
    $(CC) -c $(CC_FLAGS) $< -o $@

clean:
    rm -f $(EXEC) $(OBJECTS)
{
  "version": "0.2.1",
  "tasks": [
    {
      "taskName": "BUILD",
      "appliesTo": "/",
      "workingDirectory": "${workspaceRoot}",
      "command": "make",
      "type": "default"
    },
    {
      "taskName": "CLEAN",
      "appliesTo": "/",
      "workingDirectory": "${workspaceRoot}",
      "command": "make clean",
      "type": "default"
    }
  ]
}
'"make clean"' is not recognized as an internal or external command,      
operable program or batch file.                 
main.h:

void nothing();                   
CC = gcc
CC_FLAGS = -g
EXEC = run
SOURCES = $(wildcard *.c)
OBJECTS = $(SOURCES:.c=.o)

$(EXEC): $(OBJECTS)
    $(CC) $(OBJECTS) -o $(EXEC)

%.o: %.c
    $(CC) -c $(CC_FLAGS) $< -o $@

clean:
    rm -f $(EXEC) $(OBJECTS)
{
  "version": "0.2.1",
  "tasks": [
    {
      "taskName": "BUILD",
      "appliesTo": "/",
      "workingDirectory": "${workspaceRoot}",
      "command": "make",
      "type": "default"
    },
    {
      "taskName": "CLEAN",
      "appliesTo": "/",
      "workingDirectory": "${workspaceRoot}",
      "command": "make clean",
      "type": "default"
    }
  ]
}
'"make clean"' is not recognized as an internal or external command,      
operable program or batch file.                 
到目前为止,使用这个通用的
Makefile
编译并运行它:

void nothing();                   
CC = gcc
CC_FLAGS = -g
EXEC = run
SOURCES = $(wildcard *.c)
OBJECTS = $(SOURCES:.c=.o)

$(EXEC): $(OBJECTS)
    $(CC) $(OBJECTS) -o $(EXEC)

%.o: %.c
    $(CC) -c $(CC_FLAGS) $< -o $@

clean:
    rm -f $(EXEC) $(OBJECTS)
{
  "version": "0.2.1",
  "tasks": [
    {
      "taskName": "BUILD",
      "appliesTo": "/",
      "workingDirectory": "${workspaceRoot}",
      "command": "make",
      "type": "default"
    },
    {
      "taskName": "CLEAN",
      "appliesTo": "/",
      "workingDirectory": "${workspaceRoot}",
      "command": "make clean",
      "type": "default"
    }
  ]
}
'"make clean"' is not recognized as an internal or external command,      
operable program or batch file.                 
BUILD
的任务有效,但对于
CLEAN
我得到:

void nothing();                   
CC = gcc
CC_FLAGS = -g
EXEC = run
SOURCES = $(wildcard *.c)
OBJECTS = $(SOURCES:.c=.o)

$(EXEC): $(OBJECTS)
    $(CC) $(OBJECTS) -o $(EXEC)

%.o: %.c
    $(CC) -c $(CC_FLAGS) $< -o $@

clean:
    rm -f $(EXEC) $(OBJECTS)
{
  "version": "0.2.1",
  "tasks": [
    {
      "taskName": "BUILD",
      "appliesTo": "/",
      "workingDirectory": "${workspaceRoot}",
      "command": "make",
      "type": "default"
    },
    {
      "taskName": "CLEAN",
      "appliesTo": "/",
      "workingDirectory": "${workspaceRoot}",
      "command": "make clean",
      "type": "default"
    }
  ]
}
'"make clean"' is not recognized as an internal or external command,      
operable program or batch file.                 

您知道如何修复
CLEAN
的任务,使其按照我的要求执行make CLEAN吗?

作为
“command”
的值给出的字符串被解释为单个命令。要向命令发送参数,如
clean
,模式提供了提供参数数组的可能性。在您的情况下,它将如下所示:

void nothing();                   
CC = gcc
CC_FLAGS = -g
EXEC = run
SOURCES = $(wildcard *.c)
OBJECTS = $(SOURCES:.c=.o)

$(EXEC): $(OBJECTS)
    $(CC) $(OBJECTS) -o $(EXEC)

%.o: %.c
    $(CC) -c $(CC_FLAGS) $< -o $@

clean:
    rm -f $(EXEC) $(OBJECTS)
{
  "version": "0.2.1",
  "tasks": [
    {
      "taskName": "BUILD",
      "appliesTo": "/",
      "workingDirectory": "${workspaceRoot}",
      "command": "make",
      "type": "default"
    },
    {
      "taskName": "CLEAN",
      "appliesTo": "/",
      "workingDirectory": "${workspaceRoot}",
      "command": "make clean",
      "type": "default"
    }
  ]
}
'"make clean"' is not recognized as an internal or external command,      
operable program or batch file.                 
      "command": "make",
      "args": [ "clean" ],