[Kst] CFITSIO Problem

Peter Kümmel syntheticpp at gmx.net
Sat Aug 3 09:02:20 UTC 2013

On 03.08.2013 00:44, Nicholas Chapman wrote:
> Hi, no, I haven't solved the problem yet.  After talking to someone
> here and spending some time searching on the internet, my best guess
> is that it is a problem with linking a c library (cfitsio) into a c++
> program (kst).  That would explain why the linker complains about an
> undefined symbol _ffclos, when cfitsio defines ffclos.  See the
> following for a description on how to link c programs into c++:
> http://stackoverflow.com/questions/4598308/how-do-i-compile-and-link-c-code-with-compiled-c-code
> I've tried the solutions suggested there in just about every possible
> place (such as wrapping the #include statement directly in my plugin,
> then editing longnam.h (called by fitsio.h) and fitsio.h in various
> ways with 'extern' commands.)  None of these have worked.

should work without such changes, the fitsimage plugin just includes <fitsio.h>

> Peter, I tried adding the command you suggested to the CMake Wizard
> dialog, but I get the following error:
> CMake Error: The source directory
> "/Users/chapman/data1/Applications/ksttmp/--Dkst_3rdparty_build=1"

Ah sorry, it must be "-D..." not "--D..."

> does not exist.
> I am building the code in a separate directory named ksttmp, so
> perhaps I just need to modify the path appropriately (from ../kst to
> something else), but it isn't obvious to me what that should be.

QtCreator only wraps command line arguments. When you have problems
with the build system you should switch to the shell. To test start
from scratch in a in a empty dir with

cmake -G"CodeBlocks - Unix Makefiles" <path to kst sources> -Dkst_3rdparty_build=1

the -G argument specifies which build system you wanna use:

-G"Unix Makefiles"  build with make, default on Linux
-G"CodeBlocks - Unix Makefiles"  build with make, but also generate XML files which QtCreator/CodeBlocks could read
-GXcode   generate XCode project files, default on Mac

then you also have to point cmake to the source code: <path to kst sources>

Additional arguments are passed by -D.

After the first successfull run you could call "cmake ." and cmake lists all -D arguments

> One option I haven't tried yet is to re-write my plugin to use ccfits
> instead of cfitsio.  ccfits is a c++ version of cfitsio.

Should not be necessary.

Does it build the fitsimage plugin? If yes, you could try to figure out what is different in your plugin.
Or copy & paste some code into this plugin and see what happens.


More information about the Kst mailing list