Stanford's StanfordCPPLib on linux - c++

I'm using Suse Linux 13.1 and self studding Stanford's CS 106b course. Here I have found ziped libraries http://www.stanford.edu/class/cs106b/homework/2-ngrams/cs106b-hw2-ngrams-starter-files.zip and downloaded.
Now questions:
This libs are for windows, so some changes will be needed to make them work correctly in linux. what changes?
Where to put this folder, so that gcc compiler could automatically find this libs?

This quarter, the CS106B and CS106X course websites is behind WebAuth (Stanford's authentication system), so you won't be able to access the site directly. Usually, though, the site is open to everyone and you can go and download any of the assignments. We've recently added support for Linux by unifying all the starter libraries into one and providing Qt Creator starter files. If you wait until the summer, the instructors for that quarter might make all the materials available online again and you should have no trouble getting the most recent version of the starter files.
Hope this helps!

Related

Should I compile Qt VS use the online installer?

I compiled Qt5 by myself years ago for a Linux project. These days I'm working on Windows and I install Qt5 using the online installer.
Here and there however I face indications that compiling Qt might led to a better debugging experience, last time I notice it was here.
From that days I was using compiled Qt I don't have any memories of better experience than using the online installer.
So I would like to know more about the possible benefits of using a Qt compiled by myself. Is it worth it? Does it give me any extras compared to the online installer?
TLDR: You can use the online installer for initial development and works great with Qt Creator. Maybe later, you might need to build it yourself.
Qt's Windows installer installs most everything you need - including pre-built reference binaries with the most common options available. Perfect for initial development. There's even an option to install the source with the binaries for easy debugging. Download the symbols too if you do this.
You may want to compile the binaries yourself would be for any of the following reasons:
Build with your own custom patches
In case you need to change a build option like the renderer or openssl linkage.
You have a business requirement to build all code you ship.
At least those are the 3 reasons why we build Qt binaries directly ourselves on my team.

Stanford cs106b C++ library in XCode 8

I am right now trying to solve the exercises of the free cs106b class, but cannot succeed to setup the needed libraries. I am new to C++ and not that experienced in XCode. I tried to to directly copy the library files I found on [Github] into my XCode project. I tried now for hours to get this package working but it seems they have to be installed in a special way.
I would be glad if somebody could give me some references on how to install a C++ library in XCode, especially the library given by Stanford.
P.S. with the "old" class I was given an .pkg installer, which I installed but did not seem to change anything.
I cannot help much with the XCode IDE. I have personally completed the course myself; however I used QT creator. The CS106B or CS106X official website (version 2016) provides very good documentation about how someone can go about and get started. http://web.stanford.edu/class/cs106b//handouts/qt-creator.html
A point to note: I used the SEE CS106B videos (the online cs106B) to complete the 2016 CS106X course. Please have a look around for the assignment files, in the official cs106B/cs106X website. In case you cannot find it, let me know, I can send it to you. I hope this helps.

How to install spread library on Windows

Ther are many articles about how to install spread library on Linux(1. download source & unzip it 2.run ./config 3. make 4. make install) but seems no article about how to install spread on Windows......
I had downloaded spread-bin-4.4.0-Windows8_x64 from official site(my environemnt is win10), but there is no .bat or .exe file found under the unzipped folder. Does anyone know how to install spread library on Windows?
In linux, there is a standard way of installing libraries that all the software on your machine is supposed to use. In part this works because all that software is chosen in such a way that the same versions of libraries will satisfy everyone, that's what makes up a linux distribution to some extent.
In windows, the model of development is totally different. Any third party software, not from microsoft, is something the customer paid for and microsoft never signs off on it or anything. Third party stuff generally is supposed to provide its own libraries since you have no idea what other third party stuff is present. There's not much point in globally installing things since most programs won't use what you globally install anyways.
So, if you have a library on windows, you should install in whatever way the program that you intend to use it with will find it. If you are intending to install it for use with a project you are developing, that is a different question, and ultimately one about your build system or IDE.
In modern days there are things like NuGet which allow you to do things in a more linuxy way on windows. But that's quite recent and not that much software from typical user's perspective gets its dependencies that way.
After further study, I found a Visual Studio solution file:spread.sln under \win32 folder! So in conclusion, to install Spread libarary on Windows:
1. get source codes from http://www.spread.org/download.html
2. unzip
3. open solution file under \win32 folder with Visual Studio
(Please note that "do not" use relatively new version of VS since this solution is built with older VS(like VS 2010) otherwise unexpected errors occurred)
4. build solution
There you go! You can build your project with Spread library now!
P.S. This spread.sln is a Win32 solution. I'm just wonder is there a Win64 version solution file......

Allegro 4.2.3 Creating A Static/Release Build Using Visual C++ 2010 Express To Run On Other Windows Computers

I have successfully installed allegro 4.2.3 in accordance with the instructions at the following link and it all works great:
http://blog.hamidnazari.com/2010/07/21/installing-allegro-on-visual-cpp-express-2010/
The only thing I've ended up deviating from in respect to the tutorial linked above, is I've selected Windows Application instead of Console Application where illustrated within the 3rd graphical example (note selecting between Win32 Console Application or Win32 Project as illustrated in the 2nd graphical example, I've found to make no noticeable difference so far).
Selecting Windows Application where illustrated in the 3rd graphical example, has for me at least, simply resulted in NOT Needing to include the line: #define USE_CONSOLE in all my Allegro programs.
Please in respect of the tutorial linked above and the title of this post, can someone please help me by answering the following question:
Start of Question:
How can I get my Allegro games to work on other computers that use Windows, without the other computers requiring that Visual C++ 2010 Express be installed, And/Or the pre-built binary version of Allegro 4.2.3 (linked to in the above tutorial) also being required to be on the other computers and linked to/configured within Visual C++ 2010 Express, also described in the above tutorial.
End of Question
Incidentally: A great link for anyone interested in making standard C++ programs (i.e. that don't use Allegro or other various libraries) work by having a fully independent .exe file (compiled/built using Visual C++ 2010 Express) which can indeed run on other computers using windows, is below:
http://www.youtube.com/watch?v=AvrjQtFBJvk
Thank you for taking the time to read this post and I hope very much that someone is able to help.
Gary.
My Reply To Matthews 1st Answer Is Below:
Hi Matthew,
I’ve been looking on Google to try and find out how the various elements you mention, fit in with and compare to the linked tutorial in my post which explains step by step how to configure visual C++ 2010 Express with the Allegro 4.2.3 binary.
The first thing I want to check with you, is if all the binaries in the 4.4.2 section and 4.2.3 section on the Allegro.cc site, are essentially both pre-built binaries, and therefore ultimately configuring version 4.4.2 to work with VC++ 2010 should be in principle similar to configuring version 4.2.3 (or perhaps not?) I have downloaded version 4.4.2 and can see that there are indeed the same 3 folders, bin, include & lib.
Here is the link again to the online tutorial which explains how to successfully configure step by step, Allegro 4.2.3 with visual C++ 2010 Express:
http://blog.hamidnazari.com/2010/07/21/installing-allegro-on-visual-cpp-express-2010/
Working through the steps in the above tutorial, I have noticed additional elements in your initial answer which I have listed below. (Please note, although the tutorial does indeed work well for version 4.2.3, simply selecting the release option instead of debug when building does not result in the .exe files working on other windows computers (although the .exe file in the release folder does still run on my primary computer), and so I guess there are other things that need to be done in addition to selecting release.
1) allegro-4.4.2-monolith-static-mt.lib --- Does this need to be added to additional dependencies in the Input Section within the Linker dropdown for both debug and release. (Also how does this compare with the tutorial for this part of the configuration i.e. are there any other additional dependencies)
2) link to all the various Win32 libraries when you static link --- I don’t know how to link to these libraries. I’m a bit stumped on this.
3) #define ALLEGRO_STATICLINK --- Does this mean that “ALLEGRO_STATICLINK” needs adding to the Preprocessor Section within the C/C++ dropdown, as I read somebody else did in an attempt to get it all working for 4.4.2
To conclude: I suppose to ask my initial question once again considering all that has been said so far, I would ask it in the following 2 parts:
Part 1) How would the online tutorial need adding to/modifying for static builds to work successfully on other computers using windows for version 4.2.3, and would this then just mean selecting the release build option and of course keeping together any files linked with the .exe when distributing.
Part 2) If using the 4.4.2 version, again how would the online tutorial need adding to/modifying for static and dynamic builds to work successfully.
Tutorial type answers to Part 1 or 2 would be awesome for me and many other newbies
Thank you very much indeed for reading this post.
Allegro 4.2 is painfully old. You should use 4.4 at minimum. It is source compatible with 4.2 (same API) and still receives updates from time to time. Allegro 5 is where all the active development is now, but it has a completely new API. I still highly recommend that you take a look at it.
Anyway, to answer the question, yes, you need to static link. Grab a binary from here:
https://www.allegro.cc/files/?v=4.4
Link with the allegro-4.4.2-monolith-static-mt.lib file, and make sure you compile using the /MT switch (as opposed to /MD). The -static aspect means the Allegro DLL is not needed. the -mt flag means the C runtime is not needed.
You'll also need to link to all the various Win32 libraries when you static link. Also, be sure to #define ALLEGRO_STATICLINK in your project settings.
It's been a little while, but if I remember correctly there's an easy way to do this, though it's probably not the best way. It's good for just sending a little demo to a friend. Even if you just build in Debug mode, you can send the game over to other people. Copy/paste the allegro-4.2.2-monolith-md.lib file (Its name is something like that, but probably not that exactly) into the project's Debug folder (next to the .exe). You'll probably also need the MSVCR1000.lib file (or something like that. Can't remember the exact name), but you'll have to find that online somewhere.
DISCLAIMER: I've never used such a completely old version of Allegro, so this solution may not exactly be applicable. But I was using Allegro after version 5 and up to 5.6, so I know it works for newer versions. You should just use a newer version, really.

How to install MinGW correctly on Windows

I have recently started learning C++, but I require a compiler. I have tried the one packaged with Code::Blocks, but I have been told it is out of date.
I have tried reading the instructions on the website, but I simply don't know which files to download and un-zip. Is there a list of files to download? (latest version) and a folder structure I need?
I was the person that pointed you at the more up-to-date version at Twilight Dragon. The file you want there is http://sourceforge.net/projects/tdm-gcc/files/TDM-MinGW%20Installer/1.908.0/tdm-mingw-1.908.0-4.4.1-2.exe/download which is a Windows binary installer - you just run it. Note that you don't actually need to do this - the version that comes with Code::Blocks will work OK for someone starting to learn C++.
I recommend using a pre-packaged MinGW that includes some common APIs like Boost, SDL etc: http://nuwen.net/mingw.html
If I remember correctly, the only thing you must do to get it working is to modify Windows's PATH environment variable.
edit: OpenAL is not included in this package.
Here are some instructions to have a MinGW setup that I used to build Octave modules.
I have switched to using the build environment for msysgit. Just download the netinstall file and it will setup GCC, Make, etc. along with Git.