Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

visual c++ - Stanford Engineering Everywhere CS106B Library

I am currently a C# programmer and have been interested in learning more about C++ and data structures. I found the CS106B class offered free online through the Stanford Engineering Everywhere program which seems like it would be a good fit.

I've tried to install the library files they use for the class and keep getting a message that I have to have visual studio 2005 installed for the setup file to run. I don't have 2005, but I've tried the express editions of both vc++ 2008 and vc++2005. Is there any way around this that I can get the proper files installed?

The zip file containing the libraries came with two files, an exe and an msi.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Just got it to work by using some information I found here: http://www.functionx.com/visualc/libraries/staticlib.htm

I'm using Visual C++ 2008 Express. Here's how I did it:

  1. Download the PC Starter Code ZIP file for Assignment 1 from the current semester's CS106B class website. http://www.stanford.edu/class/cs106b/ In that file you'll find a folder named "StanfordCPPLib". In that folder, you'll need the StanfordCPPLib.lib and the *.h files you want to include.
  2. In Visual Studio, create a new project (File -> New -> Project). Select a Win32 Console Application, choose a name, and click Next.
  3. When the Application Wizard pops up, click Next (not Finish). In the Application Settings, check the box marked "Empty Project". Click Finish.
  4. In the Solution Explorer, right click on the Source folder and create a new .cpp file. (Add -> New Item -> Code -> C++ File)
  5. Find your new project's folder in Windows Explorer. In that folder, you should be able to find your new .cpp file you just created.
  6. Paste the StanfordCPPLib.lib and your needed *.h files you downloaded earlier into the same folder that contains your new .cpp file.
  7. Finally, you need to add the library to our new project. In Visual Studio, using the main menu, click Project -> Add Existing Item. The dialog should default to your project's folder where you just pasted StanfordCPPLib.lib. Select StanfordCPPLib.lib and click Add.

You should now be able to add an #include "example.h" for whatever .h files you copied into your project folder.

Note: Since you'll be using a newer version of Stanford's custom library, there may be some small differences between the original handouts and the new library. For instance, when using #include "simpio.h", the handouts list a function called GetLine(). In the new library, that function is capitalized differently: getLine(). Make sure you check the header files for correct syntax/usage.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...