title: CMake and QT multiple definition
body: <p>I'm using a Qt and Cmake for a project and I'm a newbie with those two things, so please bear with me.</p>
  
  <p>I have two class using Qt, one named <code>MapMaker</code> and another named <code>ImageLabel</code>. <code>MapMaker</code> inherited from <code>QMainWindow</code> and <code>ImageLabel</code> from <code>QLabel</code> </p>
  
  <p>Imagelabel possess a Class as attribute that I named Map that possess a method addObstacle. MapMaker posses an imageLabel and ImageLabel possess a Map.</p>
  
  <p>Every method of Map is in the Map.hpp file while MapMaker and ImageLabel method are in a .cpp file.</p>
  
  <p>When I'm compiling, I have this error :</p>
  
  <pre><code>CMakeFiles/mapmakerv3.dir/includes/Qtfiles/MapMakerv3.cpp.o: In function `Map::drawObstacle(int, int, bool)':
  /home/malcolm/AASS/sketch_maker/includes/MapInterpretation/Map.hpp:431: multiple definition of `Map::addObstacle(int, int, bool)'
  CMakeFiles/mapmakerv3.dir/main.cpp.o:/home/malcolm/AASS/sketch_maker/includes/MapInterpretation/Map.hpp:431: first defined here
  CMakeFiles/mapmakerv3.dir/includes/Qtfiles/imageLabel.cpp.o: In function `Map::drawObstacle(int, int, bool)':
  /home/malcolm/AASS/sketch_maker/includes/MapInterpretation/Map.hpp:431: multiple definition of `Map::addObstacle(int, int, bool)'
  CMakeFiles/mapmakerv3.dir/main.cpp.o:/home/malcolm/AASS/sketch_maker/includes/MapInterpretation/Map.hpp:431: first defined here
  CMakeFiles/mapmakerv3.dir/mapmakerv3_automoc.cpp.o: In function `Map::drawObstacle(int, int, bool)':
  /home/malcolm/AASS/sketch_maker/includes/MapInterpretation/Map.hpp:431: multiple definition of `Map::addObstacle(int, int, bool)'
  CMakeFiles/mapmakerv3.dir/main.cpp.o:/home/malcolm/AASS/sketch_maker/includes/MapInterpretation/Map.hpp:431: first defined here
  collect2: error: ld returned 1 exit status
  CMakeFiles/mapmakerv3.dir/build.make:187: recipe for target 'mapmakerv3' failed
  make[2]: *** [mapmakerv3] Error 1
  CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/mapmakerv3.dir/all' failed
  make[1]: *** [CMakeFiles/mapmakerv3.dir/all] Error 2
  Makefile:76: recipe for target 'all' failed
  make: *** [all] Error 2
  </code></pre>
  
  <p>I've double check all of my <code>ifndef</code> <code>define</code> (header guards) at the beginning of every header files and they are not the same.</p>
  
  <p>What's funny is that if I <code>inline</code> the method <code>addObstacle</code> then the error disappear. </p>
  
  <p>Here is my Cmake :</p>
  
  <pre><code>cmake_minimum_required(VERSION 2.6)
  project(mapmakerv3)
  
  set (MapMaker_VERSION_MAJOR 1)
  set (MapMaker_VERSION_MINOR 0)
  
  find_package(Qt4 REQUIRED)
  find_package( OpenCV REQUIRED)
  
  find_package( Boost REQUIRED )
  
  if ( NOT Boost_FOUND )
    message(STATUS "This project requires the Boost library, and will not be compiled.")
    return()  
  endif()
  
  include_directories("${PROJECT_BINARY_DIR}" ${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR}  includes includes/Qtfiles includes/MapInterpretation/ includes/TopologicalMap/ includes/MapComparator/ Test/Ddata/)
  
  set(CMAKE_AUTOMOC TRUE)
  set(CMAKE_INCLUDE_CURRENT_DIR ON)
  add_executable(mapmakerv3 main.cpp includes/Qtfiles/MapMaker.cpp includes/Qtfiles/imageLabel.cpp)
  target_link_libraries(mapmakerv3 ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${OpenCV_LIBS})
  
  install(TARGETS mapmakerv3 RUNTIME DESTINATION bin)
  add_subdirectory(includes)
  </code></pre>
  
  <p>I tried to compile a test file with no Qt-dependant files (no ImageLabel nor MapMaker) and only some custom class I made and the compiling goes fine. My guess is that the error is linked to the Qt part (some project configuration I have not done or I donät know about) but I have no idea how.</p>
  
  <p>The only error I know that throws a <code>multiple definition</code> error is a mistake in the header guards. What else could be the reason for this here ? </p>
  
  <p>I know it's a pretty messy question for now, just tell me what information I should provide to help. </p>