[Dcmlib] Strange link error

Mathieu Malaterre mathieu.malaterre at kitware.com
Fri Oct 21 15:44:23 CEST 2005


Jean-Pierre Roux wrote:
> Hi, everybody !
> 
> I get a strange link error, on the cvs version of gdcm :
> 
> Linking CXX shared library bin/libgdcm.so
> Building CXX object Example/AnonymizeDicomDir.dir/AnonymizeDicomDir.o
> Linking CXX executable bin/AnonymizeDicomDir
> /usr/bin/ld: bin/AnonymizeDicomDir: hidden symbol `__gcov_init' in 
> /usr/lib/gcc/i386-redhat-linux/4.0.1/libgcov.a(_gcov. o) is referenced 
> by DSO
> /usr/bin/ld: final link failed: Nonrepresentable section on output
> 
> 
> I use :
> -Wall -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function 
> -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual 
> -fprofile-arcs -ftest-coverage
> as C++ Flags
> If I don't use anyone, I don't get any error -nor compile time warnings 
> (a genuine pleasure!)-
> I use gcc version 4.0.1 20050727 (Red Hat 4.0.1-5) on Fedora Core 4

when all else fail, read the instruction :)

[How can I perform coverage test?]
http://www.cmake.org/Wiki/CTest:FAQ#How_can_I_perform_coverage_test.3F

Currently coverage is only supported on gcc compiler. To perform 
coverage test, make sure that your code is build with debug symbols, 
without optimization, and with special flags. These flags are:

-fprofile-arcs -ftest-coverage

Also make sure to pass these flags to C compiler, CXX compiler, and the 
linker. For example:

  CXXFLAGS="-g -O0 -Wall -W -Wshadow -Wunused-variable 
-Wunused-parameter -Wunused-function -Wunused -Wno-system-headers 
-Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs 
-ftest-coverage"
  CFLAGS="-g -O0 -Wall -W -fprofile-arcs -ftest-coverage"
  LDFLAGS="-fprofile-arcs -ftest-coverage"


I believe you are missing the proper LDFLAGS, or remove -fprofile-arcs 
-ftest-coverage from the C*FLAGS.

HTH
Mathieu



More information about the Dcmlib mailing list