Here are my instructions for compiling a program with newmat under VC++5 or 6 to work in console mode (i.e. run in an MS-DOS window).
VC++ 7 (i.e. the version that comes with Visual Studio .NET) is a little different and there are some preliminary notes below.
I assume you are familiar with the idea of writing and running a program in C++, in the old fashioned way, and just need advice how to compile and run such a program using Visual C++. Otherwise get a book on C++.
I am using VC++'s graphical interface.
You write a main program to carry out your analyses and calling the newmat functions you need. My file example.cpp is an example of such a main program.
Follow the following steps for setting up your project.
For a start use one of my examples (eg example.cpp), use console mode and don't try to generate a library version of newmat.
I say again: unless you are very familiar with Visual Studio for a start use one of my examples (eg example.cpp), use console mode and don't try to generate a library version of newmat. Don't try to use the library file that you can generate with my make file.
Notes
If you are making the runtime version rather than the debug version in VC++5 be sure to turn off optimisation - go to project - settings - C/C++ and select disable (debug) - not required for VC++6.
The .exe file is in a subdirectory called debug for the debugging version and in a subdirectory called release for the release version.
You can select an option to create a static library file at step 8 (call the project newmat10 and just include the newmat files) and then add the library file to another project, instead of all the newmat files. You do have to be careful to make sure you add in the debug version of the library file if you are debugging and the run version of you are compiling the run version. You can add both libraries. Then right-click newmat10.lib in the workspace window and choose settings - General in the pop-up window. Then set Exclude file from build to exclude the release version of newmat10.lib from the debug version and vice versa. You can see which version of newmat10.lib you have selected by selecting the Custom Build tab.
Workspaces are now called solutions. Follow the steps for VC++ 5 and 6 up to step 7.
At step 8 select Visual C++ projects, enter the name of your project (e.g. example), click add to current solution, and select win32 project from the templates and click OK. This should bring up the Win 32 application wizard. Click the heading applications. Then select console application and empty project. Click finish.
At step 9 select the heading add existing item in the project menu. You'll have to go up a directory to get the files.
Skip step 11 and use the configuration manager under the build menu to select whether you want the debug or release version. (When you have several projects you select the one to be compiled by clicking it in the solution manager window).
You can change the options for the project by going to properties on the project menu. Make sure the precompiled headings option is set to not using precompiled headers.
Go to step 15 to do the compile; you will get some warnings but there should be no errors. If you get masses of errors about precompiled headers go back to the previous step and turn off the precompiled header option.
You can run the project from the debug menu - use start without debugging or you can search out the .exe file. I haven't discovered how to set which of several projects actually gets run.