简体   繁体   中英

Creating a C++ visual studio project based on existing files

I've never worked with C++ or C. I'm trying to create a Visual studio project based on existing files which can be found here: example1.cpp together with the resources . As you can see this is example code of a book for OpenGl. I have opengl and glut present on my computer and they work ( tested it).

Based on the files mentioned above a created an empty C++ project in visual studio 2012 (i also have other versions installed if you can provide a solution in 2010 or so). I included the header files & the source file. Though I still get the following in my IDE:

在此处输入图片说明

with errors such as:

cannot open source file "Angle.h"

( Though the file is present in the project)

Can anyone tell me how I get these files to compile and run ?

确保文件angel.h与.cpp文件位于同一路径。

Header files need to be in same directory with source files in order to use #include with quotes.

#include "header.h"

In other words Angel.h must be in same directory with example1.cpp.

However,you can add spesicific paths to your project from Project Settings>VC++ Directories and include header files which exists in those paths using

#include <header.h>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM