Installing FLTK with Visual Studio

Installing FLTK with Visual Studio


  1. FLTK Install with Visual Studio
  2. Downloading FLTK
  3. Building FLTK library
  4. Adding FLTK library to Visual Studio
  5. Testing how it all works

FLTK Install with Visual Studio


  • These instructions explain how to download and install Fast Light Toolkit (FLTK) for bulding Graphical User Interface applications with MSVC++.

     


Downloading FLTK


  • Download the source of the latest stable release version (e.g. fltk-1.3.2-source.tar.gz) from FLTK library website. FLTK is cross-platform tool that works on Linux, MAC OS, and Windows with MSVC++ 2005, 2008, 2010, and above.

  • Unzip the downloaded file. The process takes two steps: first, it unzips into a .tar file. Next, unzip the .tar file, which creates a folder named fltk-1.3.2 (or whatever version you downloaded.) For example,

    
        C:\Users\yourname\Downloads\fltk-1.3.2
    
    

     


Building FLTK library


  1. Navigate to folder

    
        fltk-1.3.2\ide\VisualC2010
    
    
  2. Double-click the file named fltk.sln. It opens a large MSVC++ solution that includes FLTK demo apps and the library itself. Be patient, as it takes almost a minute to load all parts into Visual Studio development environment.

  3. Since FLTK is distributed as open source software, you must build the library on our own machine. Go to Visual Studio menu

    
        Build -> Configuration Manager...
    
    

    and switch active configuration to Release.

  4. Click Visual Studio menu

    
        Build -> Rebuild Solution
    
    

    Be patient as the surce code is being compiled. It will take several minutes to finish. If everything is okay, you should see a message similar to

        ========== Rebuild All: 79 succeeded, 0 failed, 0 skipped ==========
    

    at the end.

  5. Exit Visual Studio.

     


Adding FLTK library to Visual Studio


  • Once built, FLTK can be added to Visual Studio development environment. To begin, locate Visual C++ installation folder on your local machine. In most cases it is

    
        On 32-bit machine: C:\Program Files\Microsoft Visual Studio 10.0\VC
    
        On 64-bit machine: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC
    
    
  • There are two steps:

    1. Copy FL and GL folders, for example,

      
          C:\Users\yourname\Downloads\fltk-1.3.2\FL
          C:\Users\yourname\Downloads\fltk-1.3.2\GL
      
      

      to the include folder of Visual Studio:

      
          On 32-bit machine: C:\Program Files\Microsoft Visual Studio 10.0\VC\include
      
          On 64-bit machine: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include
      
      
    2. Copy all files from the lib folder,

      
          C:\Users\yourname\Downloads\fltk-1.3.2\lib
      
      

      to the lib folder of Visual Studio:

      
          On 32-bit machine: C:\Program Files\Microsoft Visual Studio 10.0\VC\lib
      
          On 64-bit machine: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib
      
      

     


Testing how it all works


  1. Start Visual Studio again.

  2. Click

        File -> New -> Project
    

    Select Win32 Project for the project type. Choose a name, e.g. fltk_win32_app, and change project location to

    
        C:\CIS255\Projects
    
    

    or something similar. Click Next on the project wizard screen and check "Empty project" option, then Finish.

  3. Click

    
        View -> Solution Explorer
    
    
  4. Right-click on Source Files and choose

    
        Add -> New item...
    
    

    Use C++ File (.cpp) for the type of the file. Name it main.cpp.

  5. The empty main.cpp file automatically opens in the editor. Copy and paste the following code:

    
    #include <Windows.h> // include Windows.h only if using WinMain
    #include <FL/Fl.H>
    #include <FL/Fl_Box.H>
    #include <FL/Fl_Window.H>
    
    // Use standard main to have console background:
    // int main()
    
    // Use WinMain if you don't want the console in the background:
    int __stdcall WinMain(
        __in HINSTANCE hInstance,
        __in_opt HINSTANCE hPrevInstance,
        __in LPSTR lpCmdLine,
        __in int nShowCmd
        )
    {
        Fl_Window window( 200, 200, "My window title" );
        Fl_Box box( 0, 50, 200, 20, "Hello" );
        window.show();
        return Fl::run();
    }
    
    
  6. In the Solution Explorer, right-click fltk_win32_app project and select Properties. You need to make the following three changes:

    
        Configuration Properties
            C/C++
                Code Generation
                    Runtime Library
                        <<Edit..>>
                            and set it to Multi-threaded DLL (/MD)
            Linker
                Input
                    Additional Dependecies
                        <<Edit..>>
                            and enter fltk.lib
    
                    Ignore Specific Default Libraries
                        <<Edit..>>
                            and enter libcd.lib
    
    

    For example,

     Additional Dependecies

    Click OK and save your changes.

  7. Click Visual Studio menu

    
        Build -> Rebuild Solution
    
    
  8. Press F5 to run the program.

  9. Everything should compile and run without any problems. If you do get an error, send me an email, so I can look at the issue.

Visual Studio 6.0是一款集成开发环境(IDE),用于开发软件应用程序。它由微软公司开发,包含了许多开发工具和语言支持,例如Visual Basic、Visual C++、Visual J++等。 要在Windows 10上安装Visual Studio 6.0,你可以参考一些教程和指南。首先,你可以取消安装Visual Studio FoxPro和Visual Studio InterDev 6.0,以解决可能出现的javasign报错问题。此外,你可以在Visual Studio Marketplace上找到Qt Visual Studio Tools,这是一个用于在Visual Studio中开发Qt应用程序的插件。你还可以参考一些关于在Windows 10上安装Visual Studio 6.0的教程,例如"How to install Visual Studio 6 onto Windows 10"和"Installing Visual Basic/Studio 6 on Windows 10"。 总之,Visual Studio 6.0是一款强大的开发工具,可以帮助开发人员创建各种类型的软件应用程序。你可以根据你的需求和平台选择适合的版本,并按照相关教程进行安装和配置。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [Install Visual Studio 6.0 on Windows 10](https://blog.csdn.net/newtelcom/article/details/78509033)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* [Visual Studio 2022 - Qt 6.0.0+ 使用前准备 环境配置](https://blog.csdn.net/iosWorker/article/details/122950400)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值