[kde-edu]: CMakeLists.txt for a library

Jason Harris kstars at 30doradus.org
Wed Aug 9 17:26:07 CEST 2006

On Wednesday 09 August 2006 03:26, Henrique Pinto wrote:
> On Wed 09 Aug 2006 04:36, Jason Harris wrote:
> > Three weeks later, I still don't know how to fix this.  I ran "make
> > VERBOSE=1", and it is linking the library (I see "-lSatLib" in the linker
> > command).  The specific error message is:
> Do you have GCC hidden visibility enabled? 
I assume this isn't a problem, because I've never had any issues with 
KDE_EXPORT'ed functions under libkdeedu.

However, I don't know how to check.  There's no "-fvisibility=hidden" flag in 
the gcc command, but there is a "-DSatLib_EXPORTS".  I can't find where this 
directive is defined.  It's similar to what happens in libkdeedu/extdate: its 
gcc command doesn't contain "-fvisibility", but it has "-Dextdate_EXPORTS".

> Are the classes or functions in 
> SatLib exported? 
Yes, each function declaration is preceded by "EXPORT".  I tried repacing 
EXPORT with KDE_EXPORT (and adding #include <kdemacros.h>).  There's also 
some weird preprocessor logic at the top of SatLib.h that can disable EXPORT, 
so I commented it out.  Neither of these changes helped.

> Did it link correctly with autotools? 
The library didn't exist when we used autotools.

> Do you use "extern C  
> {...}" to include its headers?
I hadn't done before, because I didn't know this was necessary (it's actually 
'extern "C" {...}', btw).  However, adding it didn't help, I'm still getting 
the same undefined reference errors for these functions.  Is there anything 
else I need to do in order to link to C code?

Maybe I've mishandled the CMakeLists.txt file, although the library itself 
links and installs properly.  Here's the relevant part of my CML.txt:

kde4_add_library(SatLib SHARED ${SatLib_LIB_SRCS})
target_link_libraries(SatLib m)
set_target_properties(SatLib PROPERTIES VERSION 0.1.0 SOVERSION 1 )

The code is pretty simple, so I'm guessing that a knowledgeable person will 
see the problem pretty quickly.  Would you mind trying to compile kstars 
yourself after uncommenting SatelliteComponent::init() ?

thanks for your ideas,

KStars: http://edu.kde.org/kstars
Community Forums: http://kstars.30doradus.org

More information about the kde-edu mailing list