how can I link mysql in dev-c++? - c++

I tried a lot of solutions on google and baidu but none of them work. I downloaded and installed the 'MySQL.DevPak' file but still got the error 'mysql.h: No such file or directory'. Is there anybody done this before?

You probably have to declare the package to dev-c++. Look in the project configuration for 'Add an external library' and declare it there. DevC++ needs this to know where to look for 1) the header file, and 2) the actual library. And that is has to link the library into the executable.
Also, you might have to use #include <mysql/mysql.h>. At least in Linux, there's a mysql directory containing the actual mysql.h

Related

C++ zlibstatic library in VS2019

I'm in the process of learning C++ and I'm halfway through one of my courses so I figured I would try to do something to challenge myself and I'm getting stuck on what I'm trying to do. Long story short I'm trying to parse some info from a file inside of a zip folder.
I followed this post here to understand what to do but I'm missing something that is not quite ovvious to me: How to use zlib library in visual studio 2017?
I'm using VS2019
I researched the libzip and zlib libraries online and realized that I need to get the zlibstatic.lib into my project. I've read through the above posts and I thought I set my paths and folders correctly, but I'm getting an error not being able to source the file.
enter image description here
enter image description here
Thanks for any advice in advance! I hope everyone is staying safe!
Cheers!
MattG
Well you can see that there is no file called zlib.h in the directory you specified. I don't know zlib but usually the header files are in a searate directory. Often it's called include something or other.
Bottom line, in the 'Additional Include Directories' setting you need to specify the folder containing zlib.h, not zlibstatic.lib.
I'm guessing you will also need to add zlibstatic.lib to the Linker/Input/Additional Dependencies setting. It's not enough just to specify the directory where the library is, you have to name it as well.

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.

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

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.

unable to compile examples in ODEINT package

I am trying to solve a coupled set of ODE's in C++, and I have decided that I want to try out odeint (available here) as I have read many good things about it. However I am having compiling the examples that are included in the package. Here is the situation:
So far I have only downloaded the package and extracted it. I am running Visual C++ 6 on Windows XP and I am compiling the example "simple1d". I get the error message: "Cannot open include file: 'boost/config.hpp': No such file or directory".
It is not clear to me what I am missing. Do I need the full boost library to make this work? I was under the impression that ODEINT is a "standalone" package.
Your error says that compiler can not find the boost libraries. You should download them from boost.org and also add them to your header path.
Where did you download and extract the package to? The package homepage says that it's a header-only package, so you only need to let Visual find the header files. I haven't used Visual in a while, but a quick google of something like "Visual 6 add header path" should be a good place to start. Take a look at Where does Visual Studio look for C++ header files?.
Quoting from this page:
Within Visual Studio, go to the Project Settings dialog. We want to change the settings for both Debug and Release versions, so under the Settings For field, select "All Configurations". Under the C/C++ Tab, select Preprocessor options.
The package tarball has a directory called boost: you want to add the path of that directory into the Additional include directories box and then #include <boost/numeric/odeint/config.hpp> in your code.
Update
It appears, then, that you already have the odeint headers installed properly: the file boost/numeric/odeint/config.hpp has a line #include <boost/config.hpp>, which is what visual must be complaining about; so I guess the package is not standalone. It must need other boost header files installed. I can't find anything in either the package homepage or the package tarball that mentions any dependencies, so I suppose you should try to install boost too. Download version 1.51.0 here, and this is the windows documentation.
You must download odeint from http://headmyshoulder.github.io/odeint-v2/downloads.html and Boost c++ libraries from http://www.boost.org/users/history/version_1_51_0.html.
If you use codeblocks right click your project, select build oprions, select Search Directories and add two references one for odeint and one for boost.

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.