# \_\_imp error when setting up glfw and glad

**URL:** <https://discourse.glfw.org/t/imp-error-when-setting-up-glfw-and-glad/2819>\
**Category:** support\
**Created:** [January 19, 2025, 6:48pm UTC](https://discourse.glfw.org/t/imp-error-when-setting-up-glfw-and-glad/2819 "2025-01-19T18:48:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonathan9267](https://avatars.discourse-cdn.com/v4/letter/j/a5b964/32.png) [@jonathan9267](https://discourse.glfw.org/u/jonathan9267)\
**Post date:** [January 19, 2025, 6:48pm UTC](https://discourse.glfw.org/t/imp-error-when-setting-up-glfw-and-glad/2819/1 "2025-01-19T18:48:48Z")

</div>

I am trying to setup a project using CMake. I am setting up my CMakeLists like so:

```auto
cmake_minimum_required( VERSION 3.6 )

project (Test)

set( GLFW_BUILD_DOCS OFF CACHE BOOL "GLFW lib only" )
set( GLFW_INSTALL OFF CACHE BOOL "GLFW lib only" )
set(GLFW_BUILD_SHARED OFF CACHE BOOL "Build GLFW as static library")
set( GLAD_SRC glad/glad.c )
set(GLFW_BUILD_GLAD OFF CACHE BOOL "Disable GLFW's built-in GLAD")

add_subdirectory( glfw )

include_directories( glad/ )

set( Test-SRC engine.cpp
        stb/stb_image.cpp
        ${GLAD_SRC}
)

add_executable( ${PROJECT_NAME} WIN32 ${Test-SRC} )

target_link_libraries( ${PROJECT_NAME} PRIVATE glfw )

```

I am getting a bunch of errors, all something like:  
undefined reference to `\_\_imp\_glfwSomething’

I am getting glfw by cloning the github repository as a subdirectory in my project.

What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [January 19, 2025, 7:27pm UTC](https://discourse.glfw.org/t/imp-error-when-setting-up-glfw-and-glad/2819/2 "2025-01-19T19:27:23Z")

</div>

I recommend you try the [GLFW-CMake-starter](https://github.com/enkisoftware/GLFW-CMake-starter/blob/main/CMakeLists.txt) and go from there.
