Installing C++ libraries(specifically Audiere) on windows? - c++

Hey this is probably a really easy beginner question but I'm trying to use the library Audiere to play some music files in Qt. I tried to install the library the way the tutorial said(i.e put the header file in MinGw's Include folder.
Yet i Keep getting the same error message:
cannot find -laudiered
So my main question is can you guys teach me how to install a library on windows? I don't really understand the qmake stuff so i just use the Qtcreator IDE to compile and run my program.
Thanks.

Including the header only provide's the library's declarations, which is fine for the compiler. You're getting a linker error because you haven't told it where to find the library's binary implementation files (.lib for static libraries on Windows).
You need to inform the linker of where to locate the necessary files. Most libraries will provide information on this in their documentation, but you can also try locating them yourself in the library's folders.
I downloaded and had a quick look at Audiere. The file you need to link to is in the /lib folder.
See this question for how to do it in QT Creator.

Related

How to include SFML source code into my visual studio 2017 c++ project and compile

I have been programming a game in c++ using the sfml library. However, I would like to adjust some of the code of that library, and use that altered code in my project.
So instead of linking the dll I would like to add the source code and then play with that source code. (e.g. for speed optimization).
I know that doing something like that is generally speaking a bad idea. Howeover, I want to learn by playing around a bit and trying different things.
So how would I add the sfml source code to my c++ project in MS visual studio. Note that I am a total noob. I already tried adding the sfml folder that I downloaded from git in the project properties page called "Additional Include Directories", but i am getting errors, of the form "Cannot open include file: 'SFML/Graphics/GLCheck.hpp': No such file or directory" so I guess that i have not yet done enough.
If you want to modify the source code in the library, all you'd have to do is just navigate to where you have SFML installed and go into the code files with a text editor and edit them.
Then, you could link the library to your VS project the same way you would normally but that library is now modified by you.
Seeing as you have a search directory issue already in VS, you must fix that first. Fix that and then go and modify the library's .hpp, .h, .cpp, whatever files in-place.
To fix the search issue.... I don't use VS for graphics, I use CodeBlocks so I am not sure about their GUI to link libraries and change search directories... but, find out where you installed SFML. Check your /usr/include/, it's probably there. Specify that path in the search directories. Just go and find where that GLCheck.hpp file is located. For Example: Say it's full path is /usr/include/SFML/Graphics/GLCheck.hpp... then /usr/include/SFML/Graphics/ or just /usr/include/ (VS might handle it recursively) needs to be in the list of SEARCH DIRECTORIES.

Where to tell Qt Creator to search for header files for auto-complete

I am writing a C++ program in Qt Creator in Ubuntu, which links to a third-party library. I have downloaded this package through aptitude to get the header and library files. In my CMakesLists.txt, I tell the compiler how to search for these files. However, how can I tell Qt Creator where to look for the header file during code editing? As it stands, my program will compile, but auto-complete does not work because Qt Creator does not know yet where the files I have #included are located on my system; it only knows after looking at CMakesLists.txt.
QtCreator needs to run cmake in order to get that information.
When you open the project it prompts you to run cmake.

installing external 'library?' in codeblocks

I'm new to programming and wanted to check this program called primesieve. http://primesieve.org/
I have windows 7 with codeblocks ide.
I tried searching for a way to execute the program but couldnt find anything useful.
I have never added a library (is that called a library?) before so please help.
similar:
Installing c library in codeblocks
cant install GMP library in codeblocks
You should have received a .h (or .hpp) file and a .lib file, most likely with the names primesieve.h (or primesieve.hpp) and primesieve.lib (or something similar).
If you didn't receive those files in your download, then you may have to download the source. It should definitely have the .h/.hpp file, but it's possible you'll need to generate the .lib file yourself. There should be instructions for your system.
You need to include the .h/.hpp file in your source code. You need to link against the .lib file. This part is described in the articles you linked.

Netbeans C++ using MinGW and the libnoise library

Using netbeans 7.2 and the most recent version of MinGW (using installer) I can't use the libnoise library. I am properly including the header files, the auto completion confirms this, however the library is simply not working. There is a .lib file and a .dll. I have tried every possible combination of adding them under project > properties > Build > Linker as well as putting the .dll in the base project directory. Despite all this I am still getting undefined reference errors whenever I try and run the code. Does anyone know what to do?
I know that it is possible to link import library files (*.lib) with MinGW, but I still suggest to recompile libnoise.
With the current Makefile, this is not very easy and may break. Thus I've written a CMake script, which doesn't only work on Windows, but should work on all CMake supported platforms. In addition to this, I've cleaned up the directory structure. The code itself hasn't been touched and when you build a library it should essentially be the same as the current one.
libnoise on GitHub
After you've built your shared library, you'll have a libnoise.dll.a and libnoise.dll file. You then add libnoise.dll.a to the linking settings and put the DLL itself next to the binary, or in the working directory.
You have to link the lib file (= adding it to linker libraries) and put the dll to
<project root>/dist/<...>/
(where your exe is put to). There's no need to add the dll to linker too.
Can you please post the error message you get?

Why is VisualStudio looking for this lib file? LNK1104 error

We have a large project using VS2008 and boost 1_42. I'm trying to upgrade to VS2010 and boost 1_44. I installed VS2010 and boost 1_44 and converted the project. Now I am trying to build, and everything compiles, but fails when linking:
LINK : fatal error LNK1104: cannot open file 'libboost_thread-vc90-mt-1_42.lib'
I have changed the include and lib directories to point to the new boost 1_44 files and I have renamed the old boost 1_42 directory.
Why is the linker still looking for a vc90-1_42 file, when it is only using 1_44 headers? Is there a way that I can determine WHY the linker wants this file? The linker obviously thinks it needs the file, but why?
I have cleaned the project and I am re-building to ensure any old build files are erased.
I've run into exactly this problem a couple of times too. It's usually been some old temporary files but like in your case cleaning didn't always do the trick straight away. Does your project include any static libs that might have been built with 1.42?
Something you can try which may or may not be helpful in tracking down your issue:
Rename the old boost directory back to it's original name
Clean the solution
Under C/C++->Command Line->Additional Options add "/showIncludes"
Under Linker->Command Line->Additional Options add "/verbose:lib"
Rebuild all
Then when you build you'll be able to see at which point 1.42 headers are included, etc. in the output window. Somehow doing this helped me in tracking down where the problem was.
Along with changing the lib directory, you need to change the name of the boost library. That's in the Linker | Input section of the project settings.
Your added comment makes it clear that the dependency on the Boost 1.42 library was being created indirectly by another library that hadn't been rebuilt.
For this you basically have two choices: either add that library as a project to your main solution, and make sure it has enough dependency information that it'll be re-built when you upgrade Boost, or use the /Zl compiler switch when you build your library. This tells the compiler you're building a library so you do not want to embed library dependencies like this.
Boost uses
#pragma comment(lib)
command to inform the linker of libraries it needs to link with. It is not an error. If Boost says you need it, it's likely you do.
On How can I find out why the linker wants this file?
There are programs which will go through your app and dlls/libs and report the content of manifests and what the binaries report they depend on. You could then scan the report for the unexpected libraries being included. We used this mainly to find libs including the previous version of the VC runtime.
Have not used the one we had in about 5 years though, now if only I could remember the name of the app!
DependancyWalker (depends.exe) will allow you to see dependancies of dll/exe but not static libs.
You could open each binary as a 'file' in MSVS and look at the manifest content by hand, but I imaging this would be a bit painful. I've not tried this with a static lib.