带有 Visual Studio Code 的 FLTK 库 [英] FLTK library with Visual Studio Code
问题描述
我正在尝试从编程原理和实践中为第 12 章安装 FLTK 库,但无法识别构建命令.我该怎么办?谢谢!
I'm trying to install FLTK library for Chapter 12 from Programming Principles and Practice, but the build command is not recognized. What should I do? Thanks!
PS D:\3. Programming\C++\GUI\fltk-1.3.5> make
make : The term 'make' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At line:1 char:1
+ make
+ ~~~~
+ CategoryInfo : ObjectNotFound: (make:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
推荐答案
我通常对 Makefile 感觉更舒服,所以我将 VS Code 设置为在我的项目中使用 Makefile.安装FLTK后,我做了以下步骤.
I usually feel more comfortable with Makefiles, so I set VS Code for using the Makefile within my projects. I have done the following steps after installing FLTK.
我创建了一个包含我所有源文件、头文件等的目录.假设我有一个
FLTK_ex
文件夹,其中包含hello.cpp
及其Makefile
I create a directory containing all my source files, headers and so on. Let's say that I have a
FLTK_ex
folder withhello.cpp
and itsMakefile
我打开 VS Code,然后 File->Open
并选择文件夹 FLTK_ex
I open VS Code, then File->Open
and I select the folder FLTK_ex
从 Terminal
菜单中,我选择 Configure Default Build Task...
:在出现的菜单中,我选择 Create tasks.json file从模板
然后其他
From the Terminal
menu, I select Configure Default Build Task...
: in the menu that appears I select Create tasks.json file from template
and then Others
出现一个默认的json文件,我修改为
A default json file appears, I modify it as
{
"version": "2.0.0",
"tasks": [
{
"label": "Build",
"type": "shell",
"command": "Make",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
为了编译,进入Terminal
菜单并选择Run Build Task...
For compiling, go to Terminal
menu and select Run Build Task...
为了运行程序,在Run
菜单中选择Run without debugging
,C++
For running the program, in the Run
menu select Run without debugging
, C++
出现一个 launch.json
文件:将其修改为(其中 myprogram
是可执行文件名称)
A launch.json
file appears: modify it as (where myprogram
is the executable name)
{
"version": "0.2.0",
"configurations": [
{
"name": "(lldb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/myprogram",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb"
}
]
}
为了有效地运行程序,在Run
菜单中再次选择Run without debugging
.
我有 FLTK 1.3.5、macOS Catalina 10.15.5、clang 版本 11.0.3、VS Code 1.47.
I have FLTK 1.3.5, macOS Catalina 10.15.5, clang version 11.0.3, VS Code 1.47.
为了在 VS Code 中使用 FLTK,我只是按照说明(在 Readme.OSX.txt
中)简单地安装 FLTK 库,Windows 系统有一个类似的文件(README.MSWindows.txt
).
In order to use FLTK in VS Code, I just followed the instruction (in Readme.OSX.txt
) for simply installing FLTK library, there is a similar file for Windows systems (README.MSWindows.txt
).
为 FLTK
编写 Makefile
的指南是 此处,如果您需要有关 Makefile
的更多见解,可以找到完整指南 此处 或更短的介绍 此处.
The guidelines for writing a Makefile
for FLTK
are here, if you need more insights on Makefile
s you can find a complete guide here or a shorter introduction here.
这篇关于带有 Visual Studio Code 的 FLTK 库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!