C/C++ Integrating Numerical Methods in VC++: Library Recommendations and Compatibility

AI Thread Summary
For numerical integration in C++ with Visual Studio, the GNU Scientific Library (GSL) is recommended as it is compatible with Windows despite initial concerns about its Linux-only reputation. Boost is also suggested as a powerful library, although it may require a steep learning curve for beginners unfamiliar with external libraries. Resources like Jeff Cogswell's C++ Cookbook can help users understand how to integrate these libraries into their projects. Adding references in Visual Studio is similar to C#, allowing users to link .dll files easily. Overall, while using external libraries may seem daunting at first, the process is manageable with the right guidance.
DukeLuke
Messages
92
Reaction score
0
I'm doing some numerical integration using C++ with Visual Studio. Are there any free online libraries where I can find routines to help with this? If there are, what is recommended and would be compatible with VC++? I have looked at the GNU library, but from what I understand this only works on Linux. Any advice would be great.
 
Technology news on Phys.org
DukeLuke said:
I'm doing some numerical integration using C++ with Visual Studio. Are there any free online libraries where I can find routines to help with this? If there are, what is recommended and would be compatible with VC++? I have looked at the GNU library, but from what I understand this only works on Linux. Any advice would be great.

GSL works perfectly well under Windows; it is, after all, portable code. The first result on a google search for "gnu scientific library" + "visual studio" gives here, for example.

There are also loads of other relevant libraries. Given that you're developing in C++ I'll assume that you're already familiar with Boost. Why not use that?
 
There are also loads of other relevant libraries. Given that you're developing in C++ I'll assume that you're already familiar with Boost. Why not use that?

Thanks, I took a trip to the library and found a lot of what I was looking for in a few books. I have heard a lot about boost, so I downloaded the standard package. I'm not sure how to use it though, becuase I have never used outside libraries before. I tried to read the instructions, but most of it was over my head. Is there a place where I learn the basics of using other libraries in my program.
 
DukeLuke said:
Thanks, I took a trip to the library and found a lot of what I was looking for in a few books. I have heard a lot about boost, so I downloaded the standard package. I'm not sure how to use it though, becuase I have never used outside libraries before. I tried to read the instructions, but most of it was over my head. Is there a place where I learn the basics of using other libraries in my program.

If you've never used an external library in your code you're probably getting a bit ahead of yourself by attempting to use Boost; it's an immensely powerful set of (mainly header) libraries and, as a result, requires a correspondingly large investment of time to understand.

If you're interested to see how to include external libraries you could do worse than checking out Jeff Cogswell's C++ Cookbook (O'Reilly).
 
Are you integrating a function all the time?
Is it the same function all the time?

Or are you integrating data from a plot?

The NETLIB site might have a routine, but most of the routines posted there are written in FORTRAN. You would either have to f2c the code, or translate it manually.
 
DukeLuke said:
Is there a place where I learn the basics of using other libraries in my program.

In Visual studio that's equivalent to adding references. You left click your project and add reference. Browse to .dll files and add them. (I have been doing this in c# and I am sure that c++ should be very similar).
Rest is same as using any other standard library.

Refer to
http://msdn.microsoft.com/en-us/library/e6w9eycd(VS.80).aspx

P.S. Using external libraries is really easy and you do not need to know anything about it other than 6-10 lines instructions. Yes, first time can be bit hard.
 
I place all of the following information in the stdafx.h file.


This is an example linking to Oracle libraries...

Code:
#include "C:\Oracle\Ora92\oo4o\CPP\INCLUDE\oracl.h"

#ifdef _DEBUG
	#pragma comment(lib, "C:\\Oracle\\Ora92\\oo4o\\CPP\\LIB\\DBG\\ORACLM32.lib")
#else // _DEBUG
	#pragma comment(lib, "C:\\Oracle\\Ora92\\oo4o\\CPP\\LIB\\ORACLM32.lib")
#endif // _DEBUG

This is an example linking to OpenGL libraries...

Code:
#include <gl\gl.h>
#include <gl\glu.h>
#include <gl\glaux.h>

#pragma comment(lib, "glu32.lib")
#pragma comment(lib, "glaux.lib")
#pragma comment(lib, "opengl32.lib")
 
Last edited:
Back
Top