Code::Blocks and Lapack - c++

How do you add Lapack libraries to Code::Blocks IDE on Windows?.
The files I have are these: (Victor's Compiled binary libraries for Windows on this page:
http://www.stanford.edu/~vkl/code/libs.html)
lapack_win32.a
lapack_win32.def
lapack_win32.dll
lapack_win32.exp
lapack_win32.lib
How would look like a simple example in C/C++ using the dynamic library?
Do I use #include <lapack>? or how?

First assuming you have installed these libraries in C:\LapackLib.
Click on the Settings Menu and then select the Compiler menu item.
From the Compiler Settings Dialog select the Directories Tab.
Click the Add button.
In the window that pops up type in your library path in this example it is C:\LapackLib\.
Select the Linker tab
Repeat steps 3 and 4, then press the Ok button to close the Compiler Settings Dialog
Right click on your project name from the Treeview on the left hand side of the screen, it will in bold.
From the popup menu select the Build Options menu item
Select the Linker tab
From the Link Libraries window, click on the Add button. Select the path to your library from the File Dialog, in this case it is C:\LapackLib\lapack_win32.lib. Then press the Ok Button.
In your source code add the relevant include declaration
e.g. #include <lapack> or #include "lapack.h"
For further information see the following tutorial or the CodeBlocks manual.

Related

Link External Library in Xcode C++ Project

I've found answers to this question, but they don't work for me. I'm trying to build a C++ project in Xcode that uses external libraries from ffmpeg and openCV, and I can't figure out how to link them. As recommended, I go the "Build Phases" screen, and there's a place for "Link Binary with Libraries." One of the libraries I need to link with is at /usr/local/lib/libavutil.a. When I try to add a library, a list box pops up showing two folders: "OS X 10.11" and "Developer Frameworks". The library I need is not in either of these folders. I tried clicking on "Add Other" and a file chooser dialog comes up, but if I type "/usr/local/lib/libavutil.a" in the search box, the dialog doesn't accept it.
I've found that typing '-lswcale -lavcodec -lavdecice' etc. on the "Other linker flags" line in "Build Settings" works, but it's not what I hoped for. I was hoping to get a file chooser dialog, where I could simply click on the libraries I want to use.
Is there a way to accomplish what I want?
If I understand correctly what you are asking, you simply want to "set" the file chooser dialog at the right place, right?
If so, you just have to press Cmd + Alt + G once you are in the file chooser dialog, after clicking on "Add Other..." in the "Link Binary with Libraries" menu. A "Go to the folder:" dialog comes up, and there you can type the fullpath to the file or the folder you are looking for.
Hope that helped!
Since nobody else has provided a working answer, I am documenting that the only only thing I have found that works it to set the search paths for the libraries under "Library Search Paths" and then to add a -l flag for each library in the "Other Linker Flags" section, just as you would on the command line command line:
According to this, you can try:
1) Open the left panel, goto "ProjectName", Targets, Build phases,
Link binary with libraries and select your library.
2) Open the left panel, goto "ProjectName", Project, Header Search
Paths, write the path where the headers of your library are (the .h
files, usually in /usr/local/include).
3) Open the left panel, goto "ProjectName", Project, Library Search
Paths, write the path where your libraries are (the .a or .dylib
files, usually in /usr/local/lib)
I hope you can confirm that this work for Xcode7.
On Step 1) You can also:
Under "Link Binary With Libraries", click on the plus button.
Click "Add Other..." (this is a 3rd party library).
Choose the filename (/usr/local/lib/libavutil.a).
P.S., I can't flag as a Dup, because that was not an acepted answer

How do I modify the include paths used by a Visual C++ project is VS 2015?

I am developing a simple C++ application in VS2015. I am getting the error message "Cannot open source file "math". So I right click the project in the solution explorer and navigate to the VC++ Directories, click the "Include Directories" entry in the right-hand pane, pull down the combo box and choose "".
The "Include Directories" dialog appears and is completely read only. I can click the "Macros>>" button and see a list of include macros, but there is no way to add them to your project.
All configuration-dependant properties, including the INCLUDE, are edited in the property-sheets:
Open the Tab "Property Manager", navigate to your configuration (i.e. "Debug | 64"), double click, and enter the include path there. (Save your edits)
Additional project-dependant INCLUDE: Open project's properties (project/Properties in Solution Manager. Navigate to "C++/Additional includes". There you can set additional includes, even if other parts of the property-dialog are readonly).
Math: Following include should be available from VS2015 environment:
#include <math.h>

How can I link winpcap in Code Blocks?

Id like to know the process to link the Wincap library and use it in my c++ project im developing in Code Blocks.
After struggling to do this myself I figured that I should post my solution here.
You will need to download the developer version of WinPCap and unzip it somewhere, lets say "C:\WpdPack_4_1_2".
In Code::Blocks, you need to add the "Include" sub directory to the search directories. To do this, go to settings->compiler and click on the "Search directories" tab. For the "Compiler" "Linker" and "Resource compiler" tabs you need to add the search path. Using the location above as an example, it would be C:\WpdPack_4_1_2\WpdPack\Include.
Once these have been added, click "OK" to return to the main screen.
Then, you need to add the library file to your project build settings. To do this, right click on your bolded project name on the left side and choose "Build options". Under the "Linker settings" tab add the path to the "libwpcap.a" file.
For example, it would be C:\WpdPack_4_1_2\WpdPack\Lib\libwpcap.a.
After I did this, the example programs compiled fine. Make sure to add the #include "pcap.h" in your program to use the library.

How do I set up an OpenGL/C++ project with GLM?

I'm using Visual Studio 2013 for an OpenGL/C++ project and now I need to work with the GLM library.
I've downloaded the library and extracted it in my project folder. Then I set [addictional directories] from the properties of the project but it keeps giving me:
fatal error LNK1104: cannot open file 'glm.lib'
But there is not a glm.lib in the .zip on the website. Here are the "includes" in my main:
#include <GL\glew.h>
#include <GL\freeglut.h>
#include <iostream>
#include <cstdlib>
#include "imageLoader.h
#include "..\glm-0.3.2\glm\glm.h"
The website you linked only provides sources for the library. You will have to build it yourself to use it.
The source provides a Makefile.am to build the library with autotools but since you are using Visual Studio, it might be a little tricky to build it this way. On the other hand, this library is really small - only ten source files or so. It will probably be easier for you to just add these sources to you current VS project and build them with the default VSC++ compilation tools.
Also, there is a more common C++ library related to Opengl with the same name. The one you are trying to use seems to load wavefront obj files. The GLM I know is a helper 3D math library with GLSL syntax (GLM).
Regarding Visual Studio 2017 I suggest following:
I suppose you have at least one toolkit, such as GLFW, freeGLUT, SDL, in folder C:\OpenGL\ and it is set up in an empty project.
Go to https://glm.g-truc.net/0.9.9/index.html and download glm.
Drag it (or copy and paste) from the window is downloaded into folder C:\OpenGL. Now in folder OpenGL you have glm and at least one toolkit.
Go to V.S. > Solution Explorer > right click the project's name > click Properties > Open the C/C++ drop-down menu > General > Additional Include Directories > Click the down arrow at the right of the field > Edit... .
In Additional Include Directories window, click the first icon, copy C:\OpenGL\glm and paste in text box.
Click [OK] in Additional Include Directories window.
In the Linker drop-down menu, click Input. Click the Additional Dependencies entry and then the down arrow at the right of the field. Select Edit in the drop-down menu. Copy opengl32.lib and paste on the top-most text box in Additional Dependencies window. Click [OK] in Additional Dependencies window.
Click [Apply] and [OK] in the Project Property Pages window.
That's all. Regards.

Adding the android-support-v7-appcompat library?

New to Android, trying to follow the training tutorials step by step, but riddled with errors, what a mess!
First stumbling block on:
http://developer.android.com/tools/support-library/setup.html
The instruction to add the library reads:
Quote:
"Add the library to your application project:
In the Project Explorer, right-click your project and select Properties.
In the category panel on the left side of the dialog, select Android.
In the Library pane, click the Add button.
..."
There is no Add button to be found in the Libraries pane in the Java Build Path, but several Add Jar, Add library and other buttons, none of which will solve the errors in Mainactivity.java.
After looking around I found that opening the Projects pane and use the Add button there resolved the errors and I could run the app. However getting problems in the next steps...