Possible to use FLTK within Visual Studio Code?

145 views
Skip to first unread message

Kenneth Burchfiel

unread,
May 3, 2020, 1:30:39 AM5/3/20
to fltk.general
Hi everyone,

I have enjoyed using Visual Studio Code in my study of C++, and am now at a point in my textbook (Programming: Principles and Practice by Stroustrup, 2nd ed.) where I'll soon need to start using the FLTK. Is it possible to use FLTK within Visual Studio Code, or would I need to switch over to Visual Studio Community?

Thank you in advance for your input.


Albrecht Schlosser

unread,
May 3, 2020, 9:15:33 AM5/3/20
to fltkg...@googlegroups.com
On 5/3/20 6:16 AM Kenneth Burchfiel wrote:
> Hi everyone,

Hi Kenneth, welcome to the FLTK community.
I'm not using VS Code myself, but I looked at the docs and watched an
introductory video and it looks interesting.

Short answer: I believe it is possible. See below.

Basically VS Code is an editor, but what you will (also) need is a build
toolchain, i.e. a compiler, linker, maybe debugger, and such. If you
have worked with Dr. B's book you may already have it, but if not it
seems to me that you need to install the C++ extensions of VS Code and
follow the instructions found at the following links for ...

(a) GCC on Windows:
https://code.visualstudio.com/docs/cpp/config-mingw
which uses Mingw-w64 (according to the description) or

(b) Microsoft C++
https://code.visualstudio.com/docs/cpp/config-msvc
where you can either use a full Visual Studio or "just the C++ Build
Tools, without a full Visual Studio IDE installation".

If you have one of these build tools working you still need to create a
working build environment for FLTK. If you're new to FLTK you can either
try the stable 1.3 version (1.3.5) or start directly with 1.4
(development) from Git. The former contains VS IDE solutions which are
now deprecated. I recommend using 1.4 where you need to create the build
environment using CMake - either select "MinGW Makefiles" if you chose
(a) above or one of the "Visual Studio xxxx" projects if you chose (b).

Once you have compiled the FLTK library using the build tools you
*should* be able to edit your own code with VS Code and build it using
the MinGW and/or VS build tools. I don't know how exactly you can do it
directly from within VS Code (documentation makes me think it is
possible because they mention debugging), but that's something you'd try
yourself.

One note on Dr. B's Book: you will notice that he adds some wrappers
around FLTK library calls and maybe creates his own widgets. This code
is known to not work OOTB with FLTK (1.3/1.4) but there are informations
on the 'net that show you how to get going. Maybe you can also find
something in the history of this group.

If you have further questions, please feel free to ask here again.

Philip Rose

unread,
May 3, 2020, 11:22:04 AM5/3/20
to fltkg...@googlegroups.com

Hi Kenneth,

 

I managed to use MS Virtual Studio to build the FLTK libraries (the latest 1.4 at the time). I basically followed the guidelines in the README.CMake.txt file with a minor tweak to reflect the version of VS I was using. You’ll find the documentation (FLTK 1.4.0: FLTK Programming Manual) for using FLTK quite satisfactory.

 

Regards Phil.  

 

Sent from Mail for Windows 10

--

You received this message because you are subscribed to the Google Groups "fltk.general" group.

To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/40e26f4b-b63f-46e4-c6a7-99d86c1e5584%40online.de.

 

Lasse Natvig

unread,
May 3, 2020, 2:41:49 PM5/3/20
to fltk.general
Hello Kenneth

We have been using the PPP textbook for two years now in a big C++ course (900 - 1000 students per year) here at NTNU, in Trondheim, Norway. This spring we changed to FLTK 1.4 and VS Code with clang. (Last spring we used MS Visual Studio Community edition for Windows, and scode on Mac). Our experience with the shift over to VS Code is very good. Unfortunately I do not have any set up guide in english, but we have a detailed description of the complete setup. It is a ZIP-file and a detailed PDF, we call it exercise 0. We have it in three variants; Windows, MacOS or linux. I can send the right version to you in e-mail, if you prefer. But, they are in Norwegian ...

Best regards
Lasse Natvig

Kenneth Burchfiel

unread,
May 3, 2020, 5:01:49 PM5/3/20
to fltk.general
Hello Lasse,

That sounds wonderful! Yes, please send it by email. I can be reached at kburc...@gmail.com. I really appreciate it!

Ken

Kenneth Burchfiel

unread,
May 3, 2020, 8:44:43 PM5/3/20
to fltk.general
Hello everyone, thank you very much for your help and assistance. It's great to have such a supportive community for this program. Lasse was kind enough to send over his documentation and project files, which will be a helpful guide for me also.

Here's where I am now in terms of trying to do this on my own:
1. I was able to successfully build FLTK 1.3.5 and incorporate it within Visual Studio Community 2019.
2. I was also able to successfully build FLTK 1.4.x, and I imagine that I could replace the 1.3.5 files within Visual Studio Community within the 1.4.x files (although this probably won't be necessary at this point).
3. I've been using Visual Studio Code with the GCC compiler successfully for a little while, so that's all set up.
4. I was able to download CMake (version 3.17.2) and use the CMake GUI program to try to build FLTK 1.4 with MinGW. I say "try" because the resulting file looked a bit different than the build I created using Visual Studio 2019 as the compiler.

Now, however, I'm stuck on how to take my build of FLTK and incorporate it within Visual Studio Code so that Code knows how to access FLTK 1.4's header files and library files. I'm guessing that learning more about CMake would help with this endeavor. Is it just a matter of positioning the header files properly within my program folder, or would I need to configure CMake in a special way?

This isn't an urgent request, since getting FLTK to work within Visual Studio Community will meet my immediate needs. But I do very much enjoy using Code and would love to find a way to integrate FLTK with it.

For what it's worth, according to a StackOverflow survey, Code is now the most popular development environment by a good margin (https://insights.stackoverflow.com/survey/2019#technology-_-most-popular-development-environments ), so it would be great to include some documentation about setting up FLTK with Visual Studio code on the FLTK website. However, I know it's easy to request such things and often much harder to implement them!

Albrecht Schlosser

unread,
May 3, 2020, 8:57:12 PM5/3/20
to fltkg...@googlegroups.com
On 5/4/20 1:53 AM Kenneth Burchfiel wrote:

[...]

> Now, however, I'm stuck on how to take my build of FLTK and incorporate
> it within Visual Studio Code so that Code knows how to access FLTK 1.4's
> header files and library files. I'm guessing that learning more about
> CMake would help with this endeavor. Is it just a matter of positioning
> the header files properly within my program folder, or would I need to
> configure CMake in a special way?

Unfortunately I can't help with integration of FLTK with VS Code, but
there is advice on creating a simple project with CMake that *uses* FLTK
in file 'README.CMake.txt' in the FLTK root directory you downloaded.

I'm not sure if this helps with VS Code integration, but it can give you
a hint how to build your own learning projects with CMake. Although it
might look complicated at first it's simple for small projects (see the
included example CMake file) and will help you with all the system
specific bits you'll need to build your project(s) - the same file can
be used on different platforms, particularly with VS C++ and with MinGW.

Kenneth Burchfiel

unread,
May 4, 2020, 5:02:31 AM5/4/20
to fltk.general
Thank you Albrecht!

Ken

On Sunday, May 3, 2020 at 12:30:39 AM UTC-5, Kenneth Burchfiel wrote:
Reply all
Reply to author
Forward
0 new messages