title: Undefined symbols for architecture x86_64: "Graphics::Graphics()", referenced from: _main in main.cpp.o
body: <p>I can't get my project to build in CLion after creating the class graphics.h and implementing it main.cpp, I've tried modifying my CMakeLists.txt 6 ways from Sunday. Can anyone help me and give me a second set of eyes to what I'm missing? I've tried stackoverflow and everywhere else. I installed my SDL packages with brew and created a pointer in ~bash.profile for where all my libs are</p>
  
  <p>main.cpp</p>
  
  <pre><code>/* Main.cpp
   * The entry point of the program
   * */
  #include "graphics.h"
  
  int main(int argc, const char* argv[]) {
      Graphics graphics;
      while(true) {
  
      }
  
      return 0;
  }
  </code></pre>
  
  <p>edit: graphics.cpp</p>
  
  <pre><code>#include &lt;SDL2/SDL.h&gt;
  #include "graphics.h"
  
  /* Graphics class
   * Holds all information dealing with graphics for the game
   */
  
  Graphics::Graphics() {
      SDL_CreateWindowAndRenderer(640, 480, 0, &amp;this-&gt;_window, &amp;this-&gt;_renderer);
      SDL_SetWindowTitle(this-&gt;_window, "CaveStory");
  }
  
  Graphics::~Graphics() {
      SDL_DestroyWindow(this-&gt;_window);
  }
  </code></pre>
  
  <p>~bash.profile</p>
  
  <pre><code>export PATH="/usr/local/sbin:$PATH"
  export C_INCLUDE_PATH=/usr/include:/usr/local/include
  export CPLUS_INCLUDE_PATH=/usr/include:/usr/local/include
  </code></pre>
  
  <p>CMakeLists.Txt -</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.3)
  project(cavestory_development)
  
  set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${cavestory_development}/cmake")
  
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -v -stdlib=libc++")
  
  set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake")
  
  set(SOURCE_FILES source/src/main.cpp)
  
  include_directories(${cavestory_development})
  include_directories("source/headers")
  include_directories("/usr/bin/clang++")
  
  find_package(PkgConfig REQUIRED)
  pkg_search_module(SDL2 REQUIRED sdl2)
  
  include_directories(${SDL2_INCLUDE_DIRS})
  link_directories(${SDL2_LIBRARY_DIRS})
  
  add_executable(cavestory_development ${SOURCE_FILES})
  
  target_link_libraries(cavestory_development
         ${SDL2_LIBRARIES}
         ${SDL2_IMAGE_LIBRARIES}
         ${SDL2_TTF_LIBRARIES})
  </code></pre>
  
  <p>Build Output from CLion -</p>
  
  <pre><code>/Applications/CLion.app/Contents/bin/cmake/bin/cmake --build      /Users/User/Library/Caches/CLion12/cmake/generated/791c20f4/791c20f4/Debug --   target cavestory_development -- -j 4
  [ 50%] Linking CXX executable cavestory_development
  Apple LLVM version 7.0.2 (clang-700.1.81)
  Target: x86_64-apple-darwin15.3.0
  Thread model: posix
   "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.11.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -o cavestory_development -L/usr/local/lib -search_paths_first -headerpad_max_install_names CMakeFiles/cavestory_development.dir/source/src/main.cpp.o -lSDL2 -rpath /usr/local/lib -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2/lib/darwin/libclang_rt.osx.a
  Undefined symbols for architecture x86_64:
    "Graphics::Graphics()", referenced from:
        _main in main.cpp.o
  ld: symbol(s) not found for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see   invocation)
  make[3]: *** [cavestory_development] Error 1
  make[2]: *** [CMakeFiles/cavestory_development.dir/all] Error 2
  make[1]: *** [CMakeFiles/cavestory_development.dir/rule] Error 2
  make: *** [cavestory_development] Error 2
  </code></pre>