【发布时间】:2021-08-30 22:01:03
【问题描述】:
我正在尝试学习惰性 foo 制作 sdl2 教程。一切都很好,然后突然我打开 vscode 看到 sdl.h 包含下的红色曲线,现在项目甚至无法编译。有什么想法吗?
生成文件
#OBJS specifies which files to compile as part of the project
OBJS = 01_hello_SDL.cpp
#CC specifies which compiler we're using
CC = g++
#INCLUDE_PATHS specifies the additional include paths we'll need
INCLUDE_PATHS = -IC:\libs\sdl_32\include\SDL2
#LIBRARY_PATHS specifies the additional library paths we'll need
LIBRARY_PATHS = -LC:\libs\sdl_32\lib
#COMPILER_FLAGS specifies the additional compilation options we're using
# -w suppresses all warnings
# -Wl,-subsystem,windows gets rid of the console window
COMPILER_FLAGS = -w -Wl,-subsystem,windows
#LINKER_FLAGS specifies the libraries we're linking against
LINKER_FLAGS = -lmingw32 -lSDL2main -lSDL2
#OBJ_NAME specifies the name of our exectuable
OBJ_NAME = project
#This is the target that compiles our executable
all : $(OBJS)
$(CC) $(OBJS) $(INCLUDE_PATHS) $(LIBRARY_PATHS) $(COMPILER_FLAGS) $(LINKER_FLAGS) -o $(OBJ_NAME)
终端输出
$ ./Makefile
./Makefile: line 2: OBJS: command not found
./Makefile: line 5: CC: command not found
./Makefile: line 8: INCLUDE_PATHS: command not found
./Makefile: line 11: LIBRARY_PATHS: command not found
./Makefile: line 16: COMPILER_FLAGS: command not found
./Makefile: line 19: LINKER_FLAGS: command not found
./Makefile: line 22: OBJ_NAME: command not found
./Makefile: line 25: OBJS: command not found
./Makefile: line 25: all: command not found
./Makefile: line 26: CC: command not found
./Makefile: line 26: OBJS: command not found
./Makefile: line 26: INCLUDE_PATHS: command not found
./Makefile: line 26: LIBRARY_PATHS: command not found
./Makefile: line 26: COMPILER_FLAGS: command not found
./Makefile: line 26: LINKER_FLAGS: command not found
./Makefile: line 26: OBJ_NAME: command not found
./Makefile: line 26: -o: command not found
【问题讨论】:
-
您为什么要尝试将 Makefile 作为 shell 脚本执行?而是运行
make并让它像往常一样解释它在工作目录中找到的任何 Makefile。 -
当我运行“ming32-exe”时它可以工作,但我在#include
下仍然有红色的suggles,我认为这与此有关,但我不知道如何修复它。它工作正常,然后开始看到此错误以修复我的包含路径,但据我了解,一切都已到位,所以我不明白