New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with linking shared libraries using Code::Blocks and CoolProp #853
Comments
Correct. On windows you want to build a STATIC library, not a shared I added some more information on C++ applications to the development Basically, you need to Just a warning, your static library will be quite huge, see this issue: On Tue, Oct 27, 2015 at 11:18 AM, loupgarou2109 notifications@github.com
|
Hopefully the instructions on that page get you going. Any issues, please On Tue, Oct 27, 2015 at 11:23 AM, Ian Bell ian.h.bell@gmail.com wrote:
|
Wow, thank you very much for this incredibly quick response. I will try to do so and then inform you. |
Sadly, I still have the same problem. I built the static library as mentioned, which is very large indeed. After that I told Code::Blocks where to find it, but it's still this message:
|
A few small comments:
I'm sure we'll get it and you are almost there. |
Yes, I think that's the point. When I specify the path to the library, Code::Blocks puts it at the end of the compilation order. I guess the path to the libraries and the library itself must be known before the debugger starts. I actually don't know how to fix that, but it seems to be a C::B related issue. |
Hmm I seem to recall as well that in Code::Blocks you could link it with Are you able to compile properly now? Setting debugger search directories On Tue, Oct 27, 2015 at 3:27 PM, loupgarou2109 notifications@github.com
|
I'm using the TDM-GCC Compiler (4.7.1). Even though I linked the static library as described in several sources, it doesn't work. Even though there is a -lCoolProp in the log-file now.
|
Sorry, I have to ask again some questions: when I build the static library in the directory "C:/user/name/CoolProp/build", which files do I have to copy in my project directory "D:/path/to/directory". What's the name of the Headerfile that I need for the static library? Do I have to put the headerfile into an input directory in my project directory? And the .a-file which was build into the lib directory? Or do I need the whole source directories? It seems that I don't understand why I need to build my own library, when there are precompiled ones here. Where is the difference? And why do they don't work, when I put the headerfile CoolPropLib.h from the static libraries directory on sourceforge into my include-directory and the CoolProp.lib from the Windows subdirectory into the lib subdirectory from my project? Sorry, so much questions... |
I am not a Windows guru, but there are two things here:
|
No, unfortunately the example code still doesn't work. |
When you try to compile the minimal example at the link above at the On Wed, Oct 28, 2015 at 2:04 PM, loupgarou2109 notifications@github.com
|
Thank you very much for your help and time. Unfortunately, it also doesn't work when I compile it from the command line:
|
The main-file contains the minimum expample: #include "CoolProp.h"
#include <iostream>
int main()
{
std::cout << CoolProp::PropsSI("T","P",101325,"Q",0,"Water") << std::endl;
return 1;
} |
Can you please try to do EXACTLY as in the static library page first? Also, I think your MINGW is a bit too old, I think you need at least 4.9 if On Wed, Oct 28, 2015 at 2:33 PM, loupgarou2109 notifications@github.com
|
just a shot in the dark, but did you try |
@ibell I'm using MinGW version 5.1:
When I compile exactly as mentioned in the static library page, I get another error:
|
The page refers to Linux and MacOS and not to Windows with MinGW. Windows handles libraries differently and that is why youy probably do not need |
Okay. When I don't use it, i get this error message:
|
Why does it not find the library? It seems that you made a step back compared to #853 (comment) . Check your include paths. Is the |
Might be a question of the standard library. I can take a look this On Wed, Oct 28, 2015 at 3:14 PM, Jorrit Wronski notifications@github.com
|
Thanks a lot for your help. |
I confirm problem linking with MINGW build on windows, with same linking error. I'm on it. |
Ok, so the problem is linking order. The
See also http://www.mingw.org/wiki/specify_the_libraries_for_the_linker_to_use |
IT WORKS!!! 😄 Thanks for your help. What I was doing: I uninstalled all compilers I have been installing over the last days when trying to compile the example file (MinGW original "older" release version 4.x or so, TDM-32 5.1, TDM-64 5.1), deleted all path variables from my environment referring to GCC compilers (of which there have been many) and reinstalled TDM-GCC-64. On the command line, I added Now I just have to tell Code::Blocks to use the TDM-64 compiler and add the option So far: thank you very very much! |
Great, good to hear it works. Please close this issue as soon as you are in business. |
I know this would be a difficult task after such long time but, can you please share the final code with the changes that you made? That would be very helpful. Thanks in advance |
Hello,
I'm new to C++-programming and I need to add the functionality of CoolProp to a turbomachinery problem. I used to add CoolProp to EXCEL and I loved it. What I wanted to do now is linking a shared library as described in here
First, I downloaded the precompiled versions with the cdecl-calling conventions. As described in here, I've been putting the CoolPropLib.h in an "include" directory, the CoolProp.lib in a "lib" directory and the CoolProp.dll in the directory where the main-file is located.
After that, I told Code::Blocks where to find the ".lib" and the ".h"-files (as a relative path).
When I use the C++ sample code from the CoolProp website:
I get these error messages:
It seems to be a problem with correct lib-linking. I also tried to compile the shared library by myself. When I managed to do so, I get the same error messages.
I can imagine quite well that this seems to be a trivial problem, but I'm soon to despair and I feel that I forgot something.
I would appreciate if anybody could help me.
Thanks in advance
Clemens
The text was updated successfully, but these errors were encountered: