`
tinggo
  • 浏览: 44726 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Compiling OpenGL Programs Using Visual Studio on Lab Windows Machines

阅读更多

Reference URL: (http://www.cs.uiowa.edu/~cwyman/classes/common/howto/compileVS.html)

Compiling OpenGL Programs Using Visual Studio on Lab Windows Machines (e.g., MLH 301):

The hardest part about compiling any program using Visual Studio is figuring out how to navigate the myriad of options. Once you figure out what is important for your project and what you should leave as default, everything is easy.

Remember, the key things you need to do are:

  • Tell Visual Studio where your code resides (or will reside).
  • Tell Visual Studio which code files to compile.
  • Tell Visual Studio what libraries you need.
  • Tell Visual Studio where to find those libraries.

The instructions below will get you through the initial step of setting up a project. Even if you have used Visual Studio before for other classes, I encourage you to read all the steps, as some selections will differ from those needed in prior courses.

These instructions work for Visual Studio 2008, though they are mostly similar for other versions:

  1. Open Visual Studio 2008.
    • If this is your first time, I encourage you to select "Visual C++" as the default configuration.
  2. Once it has completely opened (which may take some time) select from the menu "File" followed by "New" followed by "Project".
  3. In the New Project dialog box:
    • Type a name for your project and a location where you want your project directory.
    • For the project type, select "Visual C++" then "Win32" then "Win32 Console Application"
    • Click "Ok"
  4. In the Win32 Application Wizard dialog box:
    • Click "Application Settings"
    • De-select "precompiled header" (unless you know what they are)
    • Select "empty project"
    • Keep the application type as "Console application"
    • Click "Finish"
  5. You will now return to the main Visual Studio window, where a subwindow entitled "Solution Explorer" will appear. This contains information about "Solution < myTestProject >" (where < myTestProject > is whatever you named your project). Visual Studio should also have created a project directory where it will store the files. Open up the directory "< myTestProject >" and its subdirectory (also called "< myTestProject >"). There you should see a file called < myTestProject >.vcproj (or labeled "VC++ Project"). Copy any code you would like to use into this subdirectory. If there are a lot of files, you may wish to arrange them in an organized fashion.
  6. Back in the Visual Studio subwindow (the "Solution Explorer"), you should see folders labeled "Header Files" and "Source Files."
    • Right click on "Source Files," select "Add," select "Existing File" and then select the C/C++ file you wish to use (e.g., my "glut_template.c" file). Alternately, create a new file and start typing in code from scratch.
    • Right click on "Header Files," select "Add," select "Existing File" and then select the header file you wish to use (e.g., my "glut_template.h" file).
    • If you find it easier, you can drag and drop files directly onto the solution explorer.
  7. Right click on the BOLD name of your project in the "Solution Explorer."
    • Select "Properties" (all the way at the bottom of the pop-up menu)
    • Click the plus (+) next to "Linker" to see more linker options
      • Click on "Input" and add an entry to "Additional Dependencies." This entry should be "opengl32.lib glu32.lib glut32.lib" (without the quotes).
    • Click "OK" to confirm your changes and close the properties dialog.
  8. Double click on any of the listed code files to open them and begin editing.
  9. Once you have finised coding, press "F7" to compile (or build) your project.
  10. Your executable will be in the "Debug" subdirectory of the project's directory. If your executable requires no command-line parameters, you can run it directly from inside Visual Studio by pressing "F5."

If you change the project from a "Debug" to a "Release" build (which I would not recommend during this class), you may need to repeat your changes to the solution's properties page as the Debug and Release builds (by default) have separate properties.

 

分享到:
评论

相关推荐

    DriverStudio 3.2 For VisualStudio 2005 补丁

    DriverStudio 3.2 For VisualStudio 2005 补丁 &lt;br&gt;解决DriverStudio 3.2插件在VisualStudio 2005中无法使用的问题。 &lt;br&gt;原文件说明: &lt;br&gt;Compuware DriverStudio – DriverSuite Version 3.2 &lt;br&gt;...

    Compiling... ,Error spawning cl.exe错误

    - 确认“Path”变量中包含了Visual C++ 6.0的编译器路径(例如`C:\Program Files\Microsoft Visual Studio\VC98\BIN`)。 - 如果没有,需要添加这些路径到“Path”变量中。 **3. 其他可能的解决方法:** - **...

    Visual Studio 2019修改编码UTF-8的实现

    Visual Studio 2019作为微软提供的强大的集成开发环境(IDE),对于开发者的编码需求提供了全面的支持。 在Visual Studio 2019中,有时候默认的编码设置可能不满足开发者的需求,例如,如果源代码文件包含了非ASCII...

    OpenGL ES 3.0 Programming Guide, 2nd Edition

    All code has been built and tested on iOS 7, Android 4.3, Windows (OpenGL ES 3.0 Emulation), and Ubuntu Linux, and the authors demonstrate how to build OpenGL ES code for each platform. Coverage ...

    GLPK在visual 2010环境下的库函数

    标题“GLPK在Visual 2010环境下的库函数”指出,本资源致力于讲解如何在Windows平台上的Visual Studio 2010开发环境中使用GNU Linear Programming Kit(GLPK)库函数。GLPK是一个开源的线性规划(LP)和混合整数线性...

    build-libboost-windows:用于下载和构建 libboost 的批处理脚本(使用 Visual Studio 编译器)

    用于下载和构建 libboost 的批处理脚本(使用 Visual Studio 编译器) Please keep in mind compiling Boost library takes a very long time.用法: 克隆或下载此 repo 打开命令提示符并 cd 到xxx/build-libboost-...

    windows驱动讲稿1.1 - 搭建编译环境

    - **备注**:虽然Visual Studio 2010及之前的版本可以通过特殊设置集成驱动编译,但这些集成并非原生,且编译过程仍然依赖于`build.exe`而不是`msbuild.exe`。 综上所述,Windows驱动程序开发的关键在于正确安装和...

    Windows XP compiling video (Reupload).mp4

    Windows XP compiling video (Reupload).mp4

    VisualC+++6.0+通用补丁

    虽然微软公司推出了 Visual C++.NET(Visual C++7.0),但它的应用有很大的局限性,只适用于Windows 2000、Windows XP和Windows NT4.0。所以实际中,更多的是以Visual C++6.0为平台。 Visual C++ 6.0 完整绿色通用补丁...

    在MFC进行opengl编程设置

    这个过程可以通过Visual Studio的“新建项目”菜单来完成,选择“MFC AppWizard (exe)”模板,并输入项目名称。创建后的工程文件将包含MFC的基本结构。 接着,我们需要链接OpenGL库到项目中。这可以在项目的设置中...

    poppler-0.68.0_x86.7z

    So after years of pain, I jumped on oDesk and contracted Ilya Kitaev, to both compile with Microsoft Visual Studio, and also prepare automated tools for easy compiling in the future. Update: MSVC isn...

    SDL2.08源码

    Windows with Visual Studio: * Read VisualC.html Windows with gcc, either native or cross-compiling: * Read the FAQ at https://wiki.libsdl.org/moin.fcg/FAQWindows * Run './configure; make; make ...

    Inline Function Expansion for Compiling C Programs - 1989 (p246-chang)-计算机科学

    Inline Function Expansion for Compiling C ProgramsWen-mei W. Hwu and Pohua P. ChangCoordinated Science Laboratory University of Illinois1101 W. Springfield Ave. Urbana, IL 61801 (217) 244-8270hwu@...

    Code Edit Studio v1.1(最新版) 支持超过40种开发语言的超级代码

    Code Edit Studio helps the programmer in many ways., prevents errors, helps in compiling and executing code with ease. Code Edit Studio is professionally designed to meet Microsoft Windows interface ...

    Advanced C and C++ Compiling

    - Visual Studio等IDE的使用技巧。 - 调试和性能分析工具的介绍。 #### 结语 通过对本书各章节的系统学习,读者不仅可以掌握C和C++语言的高级编译技术,还能学会如何在多任务操作系统中有效地管理和优化程序。无论...

    Programming with Microsoft Visual Basic.NET_Delivery Guide.pdf

    Demonstration: Using the Visual Studio .NET IDE........................................29 Debugging Applications.............................................................................30 ...

Global site tag (gtag.js) - Google Analytics