I would like to compile a C code program which uses the CFITSIO libraries (provides by NASA for reading and writing astronomical image data files in FITS format: http://heasarc.gsfc.nasa.gov/docs/software/fitsio/)
And the instruction said:
"put the .dll file and the other .lib and .h files in an appropriate directory where you can link your programs with them"
I would like to know, where exactly should I put the .dll, .lib, .h files in my computer
(i.e. put .lib in C:\Dev-Cpp\lib\gcc....? put .h in C:\Dev-Cpp\include?...) AND
how should I "link" the library? Should I start with a Project in DEV-C++ and set the appropriate parameters, linkers, etc)
I am using DEV-C++ version 4.9.9.2 running on WindowXP Pro.
I should be grateful if anyone can provide the step-by-step instructions, or you are using the CFITSIO library. Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Include the .h file in your code. It can go into the include directory, or be in the folder with your C code (the difference is whether you use <> around the filename or "")
Put the lib file(s) somewhere that dev can see (mine are usually in the folder with the code, which is probably bad practice but it works for me).
In dev, Project-Project Options-Parameters, click the Add Library or Object button and find your lib file(s).
They should now show up in the list above the button.
Put the DLL in the same folder as the exe that dev creates.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There is a section in the thread titled 'Please Read Before Posting a Question' on the compile log, including headers and linking libraries that will help.
Please note that .lib named libraries are not necessarily portable to GCC.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2007-10-01
You put them where you like, and them tell the compiler/linker where you put them. I do not recommend 'polluting' the Dev-C++ installation with third-party libraries and headers - keep them separate.
When included with #include "file.h", the compiler looks first in the folder containing teh module being compiled, then in the paths specified by -I command line switched. When you use #include <file.h>, it just looks in the -I specified paths. Dev-C++ provides a project options dialog tab for setting these paths.
Equally library paths are specified by -L command line options, and again Dev-C++ has a dialog for setting them.
The DLL files are found at run-time. The OS will look in the executables folder first, then in any path specified in the PATH environment variable.
One other point is that the .LIB export library file is probably not a MinGW/GCC export library. Later versions of GNU (i.e. not that supplied with Dev-C++) will accept Microsoft export libraries I believe. www.mingw.org
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I actually used some .lib libraries with the gcc version that came with Dev and had success. The libraries were supplied by Agilent, and I'm not sure what compiler they're for, but I would guess it's MS. What kind of problems would you see if they're not compatible? Would linking fail, or would it work but your exe would have problems?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2007-10-01
Yes, it will fail to link if there is a problem. Try it. There are solutions if it fails.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You can find some past discussions about the nitty gritty details about why
problems occur. In particular, for C++ code, the way that functions are
exposed to code linking them is not the same across compilers.
This explanation is somewhat high level, and only touchy-feely correct, and
Soma or Clifford can give you a better one.
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
link CFITSIO library
I would like to compile a C code program which uses the CFITSIO libraries (provides by NASA for reading and writing astronomical image data files in FITS format:
http://heasarc.gsfc.nasa.gov/docs/software/fitsio/)
And the instruction said:
"put the .dll file and the other .lib and .h files in an appropriate directory where you can link your programs with them"
I would like to know, where exactly should I put the .dll, .lib, .h files in my computer
(i.e. put .lib in C:\Dev-Cpp\lib\gcc....? put .h in C:\Dev-Cpp\include?...) AND
how should I "link" the library? Should I start with a Project in DEV-C++ and set the appropriate parameters, linkers, etc)
I am using DEV-C++ version 4.9.9.2 running on WindowXP Pro.
I should be grateful if anyone can provide the step-by-step instructions, or you are using the CFITSIO library. Thanks.
Include the .h file in your code. It can go into the include directory, or be in the folder with your C code (the difference is whether you use <> around the filename or "")
Put the lib file(s) somewhere that dev can see (mine are usually in the folder with the code, which is probably bad practice but it works for me).
In dev, Project-Project Options-Parameters, click the Add Library or Object button and find your lib file(s).
They should now show up in the list above the button.
Put the DLL in the same folder as the exe that dev creates.
There is a section in the thread titled 'Please Read Before Posting a Question' on the compile log, including headers and linking libraries that will help.
Please note that .lib named libraries are not necessarily portable to GCC.
You put them where you like, and them tell the compiler/linker where you put them. I do not recommend 'polluting' the Dev-C++ installation with third-party libraries and headers - keep them separate.
When included with #include "file.h", the compiler looks first in the folder containing teh module being compiled, then in the paths specified by -I command line switched. When you use #include <file.h>, it just looks in the -I specified paths. Dev-C++ provides a project options dialog tab for setting these paths.
Equally library paths are specified by -L command line options, and again Dev-C++ has a dialog for setting them.
The DLL files are found at run-time. The OS will look in the executables folder first, then in any path specified in the PATH environment variable.
One other point is that the .LIB export library file is probably not a MinGW/GCC export library. Later versions of GNU (i.e. not that supplied with Dev-C++) will accept Microsoft export libraries I believe. www.mingw.org
Clifford
I actually used some .lib libraries with the gcc version that came with Dev and had success. The libraries were supplied by Agilent, and I'm not sure what compiler they're for, but I would guess it's MS. What kind of problems would you see if they're not compatible? Would linking fail, or would it work but your exe would have problems?
Yes, it will fail to link if there is a problem. Try it. There are solutions if it fails.
You can find some past discussions about the nitty gritty details about why
problems occur. In particular, for C++ code, the way that functions are
exposed to code linking them is not the same across compilers.
This explanation is somewhat high level, and only touchy-feely correct, and
Soma or Clifford can give you a better one.
Wayne