title: C/C++ verbose compiling error, multiple definitions
body: <p>I'm not much of a C/C++ programmer myself, but I've been tasked with building a Deconvolution program used in my lab.  </p>
  
  <p>Here is the complaint I've been getting:</p>
  
  <pre><code> [ 10%] Building (Device) NVCC /home/chris/Desktop/Clarity-1.0/src/WienerDeconvolveGPU.cu: /home/chris/Desktop/Clarbuild/src/cuda/src/WienerDeconvolveGPU.cu_Clarity_generated.cpp
  [ 13%] Building CXX object CMakeFiles/Clarity.dir/src/WienerDeconvolve.o
  /home/chris/Desktop/Clarity-1.0/src/WienerDeconvolve.cxx: In function ‘ClarityResult_t Clarity_WienerDeconvolve(float*, Clarity_Dim3, float*, Clarity_Dim3, float*, float)’:
  /home/chris/Desktop/Clarity-1.0/src/WienerDeconvolve.cxx:211: error: ‘malloc’ was not declared in this scope
  /home/chris/Desktop/Clarity-1.0/src/WienerDeconvolve.cxx:246: error: ‘free’ was not declared in this scope
  make[2]: *** [CMakeFiles/Clarity.dir/src/WienerDeconvolve.o] Error 1
  make[1]: *** [CMakeFiles/Clarity.dir/all] Error 2
  make: *** [all] Error 2
  </code></pre>
  
  <p>The normal solution I've found is to insert #include cstlib in the code, WienerDeconvolve.cxx, but when I do that, this happens:</p>
  
  <pre><code>        [  2%] Building CXX object CMakeFiles/Clarity.dir/src/WienerDeconvolve.o
  Linking CXX static library libClarity.a
  [ 89%] Built target Clarity
  Linking CXX executable ConvolutionTest
  [ 92%] Built target ConvolutionTest
  Linking CXX executable JansenVanCittertTest
  [ 94%] Built target JansenVanCittertTest
  Linking CXX executable MaximumLikelihoodTest
  [ 97%] Built target MaximumLikelihoodTest
  Linking CXX executable WienerFilterTest
  ../../libClarity.a(WienerDeconvolve.o): In function `ComplexConjugate(float2)':
  WienerDeconvolve.cxx:(.text+0x2a0): multiple definition of `ComplexConjugate(float2)'
  ../../libClarity.a(FFTGPU.cu_Clarity_generated.o):FFTGPU.cu_Clarity_generated.cpp:(.text+0x0): first defined here
  ../../libClarity.a(WienerDeconvolve.o): In function `ComplexAdd(float2, float2)':
  WienerDeconvolve.cxx:(.text+0x2c6): multiple definition of `ComplexAdd(float2, float2)'
  ../../libClarity.a(FFTGPU.cu_Clarity_generated.o):FFTGPU.cu_Clarity_generated.cpp:(.text+0x24): first defined here
  ../../libClarity.a(WienerDeconvolve.o): In function `ComplexMultiply(float2, float2)':
  WienerDeconvolve.cxx:(.text+0x300): multiple definition of `ComplexMultiply(float2, float2)'
  ../../libClarity.a(FFTGPU.cu_Clarity_generated.o):FFTGPU.cu_Clarity_generated.cpp:(.text+0x54): first defined here
  ../../libClarity.a(WienerDeconvolve.o): In function `ComplexScale(float2, float)':
  WienerDeconvolve.cxx:(.text+0x34e): multiple definition of `ComplexScale(float2, float)'
  ../../libClarity.a(FFTGPU.cu_Clarity_generated.o):FFTGPU.cu_Clarity_generated.cpp:(.text+0x84): first defined here
  ../../libClarity.a(WienerDeconvolve.o): In function `ComplexMultiplyAndScale(float2, float2, float)':
  WienerDeconvolve.cxx:(.text+0x378): multiple definition of `ComplexMultiplyAndScale(float2, float2, float)'
  ../../libClarity.a(FFTGPU.cu_Clarity_generated.o):FFTGPU.cu_Clarity_generated.cpp:(.text+0xa8): first defined here
  ../../libClarity.a(WienerDeconvolve.o): In function `ComplexMagnitudeSquared(float2)':
  WienerDeconvolve.cxx:(.text+0x3ed): multiple definition of `ComplexMagnitudeSquared(float2)'
  ../../libClarity.a(FFTGPU.cu_Clarity_generated.o):FFTGPU.cu_Clarity_generated.cpp:(.text+0xd8): first defined here
  ../../libClarity.a(WienerDeconvolveGPU.cu_Clarity_generated.o): In function `ComplexConjugate(float2)':
  WienerDeconvolveGPU.cu_Clarity_generated.cpp:(.text+0x0): multiple definition of `ComplexConjugate(float2)'
  ../../libClarity.a(FFTGPU.cu_Clarity_generated.o):FFTGPU.cu_Clarity_generated.cpp:(.text+0x0): first defined here
  ../../libClarity.a(WienerDeconvolveGPU.cu_Clarity_generated.o): In function `ComplexAdd(float2, float2)':
  WienerDeconvolveGPU.cu_Clarity_generated.cpp:(.text+0x24): multiple definition of `ComplexAdd(float2, float2)'
  ../../libClarity.a(FFTGPU.cu_Clarity_generated.o):FFTGPU.cu_Clarity_generated.cpp:(.text+0x24): first defined here
  ../../libClarity.a(WienerDeconvolveGPU.cu_Clarity_generated.o): In function `ComplexMultiply(float2, float2)':
  WienerDeconvolveGPU.cu_Clarity_generated.cpp:(.text+0x54): multiple definition of `ComplexMultiply(float2, float2)'
  ../../libClarity.a(FFTGPU.cu_Clarity_generated.o):FFTGPU.cu_Clarity_generated.cpp:(.text+0x54): first defined here
  ../../libClarity.a(WienerDeconvolveGPU.cu_Clarity_generated.o): In function `ComplexScale(float2, float)':
  WienerDeconvolveGPU.cu_Clarity_generated.cpp:(.text+0x84): multiple definition of `ComplexScale(float2, float)'
  ../../libClarity.a(FFTGPU.cu_Clarity_generated.o):FFTGPU.cu_Clarity_generated.cpp:(.text+0x84): first defined here
  ../../libClarity.a(WienerDeconvolveGPU.cu_Clarity_generated.o): In function `ComplexMultiplyAndScale(float2, float2, float)':
  WienerDeconvolveGPU.cu_Clarity_generated.cpp:(.text+0xa8): multiple definition of `ComplexMultiplyAndScale(float2, float2, float)'
  ../../libClarity.a(FFTGPU.cu_Clarity_generated.o):FFTGPU.cu_Clarity_generated.cpp:(.text+0xa8): first defined here
  ../../libClarity.a(WienerDeconvolveGPU.cu_Clarity_generated.o): In function `ComplexMagnitudeSquared(float2)':
  WienerDeconvolveGPU.cu_Clarity_generated.cpp:(.text+0xd8): multiple definition of `ComplexMagnitudeSquared(float2)'
  ../../libClarity.a(FFTGPU.cu_Clarity_generated.o):FFTGPU.cu_Clarity_generated.cpp:(.text+0xd8): first defined here
  collect2: ld returned 1 exit status
  make[2]: *** [tests/WienerFilterTest/WienerFilterTest] Error 1
  make[1]: *** [tests/WienerFilterTest/CMakeFiles/WienerFilterTest.dir/all] Error 2
  make: *** [all] Error 2
  </code></pre>
  
  <p>This is a pretty large project, and thus these are some intimidating errors for me.  Does anyone have any idea what the problem could be?  Many people have compiled this, and it's been tested on RedHat.  After messing with it a few days I'm out of ideas, but I'll be happy to provide any information that might help.</p>