I have tried downloading the files from the website and try using it directing it but it needs to be compile or generated i guess. I am new to learning C++ and fltk graphic library. Thanks in advance
How to use fltk graphic library with visual studio (community) 2022 for C++ project on Windows 11 PC
Asked
Active
Viewed 965 times
-1
-
1What issues are you facing? Please elaborate. – kiner_shah Dec 18 '21 at 07:05
-
The issue is I can't use it and don't know how to use it with visual studio. – hklsb Dec 18 '21 at 07:13
-
Here is the [link](https://www.fltk.org/index.php) for the fltk library site. – hklsb Dec 18 '21 at 07:15
-
If you are new to learning C++, suggest you to not work with libraries, instead start learning the language first and once you have a good grip on the language then start learning about libraries and how to use them. For setup if you are facing any issues, you can find many useful resources on Youtube and other websites which will guide you to properly setup Visual Studio. – kiner_shah Dec 18 '21 at 07:22
-
True. I hate to say I am learning by the book: Programming Principles and Practice by Bjarne and chapter 13, I must use fltk library in order to make the project work but without it I can't move forward. Thanks anyway! – hklsb Dec 18 '21 at 07:27
-
Then the book must mention the instructions to install that library, right? – kiner_shah Dec 18 '21 at 08:20
-
1i think so eventually. Thanks for your time. I really appreciate your effort. – hklsb Dec 18 '21 at 11:12
-
There are several videos on YouTube showing how to use FLTK with visual studio. – mo_al_ Dec 18 '21 at 11:56
-
1It is well known that the book you're learning from is based on a very old version of FLTK and that the files that accompany this book (which you can IIRC load from the internet) are broken. However, I can give you two hints: (1) If you download FLTK 1.3.8 you'll find ready-to-use visual studio projects in the ide/VisualC2010 subfolder and (2) you can also find fixes to the book's files on the 'net but I don't remember where. Without these fixes you may spend too much time finding it out the hard way. HTH. – Albrecht Schlosser Dec 18 '21 at 13:31
-
1I should add: although the project in ide/VisualC2010 is for an older version of Visual Studio you can very likely "upgrade" the project files to your current Visual Studio version (open and follow instructions). However, I don't know if this is still possible with VS2022. You're obviously living on the bleeding edge with this version and Windows 11 which is very likely not a good choice for a beginner, but YMMV. – Albrecht Schlosser Dec 18 '21 at 13:34
-
Thanks man, you are right it's so old and nothing seems to work. I will definitely try search for the file you mentioned and let's see what happens. appreciate it. – hklsb Dec 18 '21 at 16:57
-
I found the [link](https://github.com/hklsb/Install-FLTK-for-use-with-Visual-C-) you referred to maybe. But I failed again at compiling the **demo** project as per instructions from it. His was immediately successful compiling the demos though. I almost thought I did it. But it's ok. Thanks anyway @Albrecht – hklsb Dec 18 '21 at 17:35
-
Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Dec 24 '21 at 15:25
1 Answers
3
Yes!!! I finally got it.
Step 1
- I install vcpkg, follow the instructions and integrate with visual studio.
- Then I download fltk using vcpkg:
vcpkg install fltk
.
Step 2
- Finally in Visual Studio, Linker>>General>>Additional Library Directories : refer to the lib folder which vcpkg produced during installation.
- And C/C++>>General>>Additional Include Directories: refer to the include folder from vcpkg.
That's it. I hope other newbies like me could save many hours. Thanks!
Note: I tried uploading a screenshot for proof but need at least 10 reputations!

Peter Csala
- 17,736
- 16
- 35
- 75

hklsb
- 47
- 8