# Unable to include header files?

**URL:** https://discourse.cmake.org/t/unable-to-include-header-files/1881
**Category:** Usage
**Created:** [September 21, 2020, 9:30pm UTC](https://discourse.cmake.org/t/unable-to-include-header-files/1881 "2020-09-21T21:30:06Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![mbilyanov](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mbilyanov/32/842_2.png) [@mbilyanov](https://discourse.cmake.org/u/mbilyanov)
#### Post date: [September 21, 2020, 9:30pm UTC](https://discourse.cmake.org/t/unable-to-include-header-files/1881/1 "2020-09-21T21:30:06Z")

</div>

Hi,

I’m trying to reproduce the following command, so that this works with CMake.

```auto
/usr/bin/x86_64-w64-mingw32-g++ -march=x86-64 -mtune=x86-64 -O2 -shared -static -static-libgcc -static-libstdc++ -s -fno-rtti -fno-exceptions -I /home/mbilyanov/.wine/drive_c/SierraChartLinux/ACS_Source/ -w ./src/MySCStudy.cpp -o ./build/MySCStudy.dll

```

Just to make things clear, the above command generates a working DLL.

No matter what I have tried, I was not able to make this work and create the same DLL with CMake.

```
# ;--------------------------------------------------------------------------------
# ; Initials
# ;--------------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.1)
project(MySCStudy)

MESSAGE(STATUS "<${PROJECT_NAME}> CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
MESSAGE(STATUS "<${PROJECT_NAME}> CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}")

# ;--------------------------------------------------------------------------------
# ; Include Directories
# ;--------------------------------------------------------------------------------
set(SC_INCLUDE_DIR /home/mbilyanov/.wine/drive_c/SierraChartLinux/ACS_Source)
set(MINGW_INCLUDE_DIR /usr/x86_64-w64-mingw32/include)
MESSAGE(STATUS "<${PROJECT_NAME}> SC_INCLUDE_DIR: ${SC_INCLUDE_DIR}")

# ;--------------------------------------------------------------------------------
# ; Compiler Flags
# ;--------------------------------------------------------------------------------
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-march=x86-64 -mtune=k8 -I/home/mbilyanov/.wine/drive_c/SierraChartLinux/ACS_Source/")
MESSAGE(STATUS "<${PROJECT_NAME}> CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")

add_compile_options(-O2 -shared -static -static-libgcc -static-libstdc++ -s -fno-rtti -fno-exceptions)

# ;--------------------------------------------------------------------------------
# ; Source Files
# ;--------------------------------------------------------------------------------
# file(GLOB SOURCE_FILES
# "./src/*.cpp"
# )
set(SOURCE_FILES ./src/MySCStudy.cpp; ${SC_INCLUDE_DIR}/sierrachart.h)
MESSAGE(STATUS "<${PROJECT_NAME}> SOURCE_FILES: ${SOURCE_FILES}")

# ;--------------------------------------------------------------------------------
# ; Header Files
# ;--------------------------------------------------------------------------------
file(GLOB SC_HEADER_FILES
    ${SC_INCLUDE_DIR}/*.h
)
MESSAGE(STATUS "<${PROJECT_NAME}> SC_HEADER_FILES: ${SC_HEADER_FILES}")

# ;--------------------------------------------------------------------------------
# ; Properties
# ;--------------------------------------------------------------------------------
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}/${CMAKE_BUILD_TYPE}/lib)
set(CMAKE_SHARED_LIBRARY_PREFIX "")

include_directories(${PROJECT_NAME} PUBLIC ${SC_INCLUDE_DIR})
add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${SC_HEADER_FILES})

```

When building, I don’t see anything about the header files being picked up and the resulting DLL is broken. No error messages in the terminal.

This is all under Linux. I’m building this Windows DLL under Linux using `x86_64-w64-mingw32`

Could you please help me. I have been struggling with this for quite a while and I don’t understand what I’m doing wrong.

---

<div class="post-metadata">

### Author: ![mbilyanov](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mbilyanov/32/842_2.png) [@mbilyanov](https://discourse.cmake.org/u/mbilyanov)
#### Post date: [September 22, 2020, 9:31am UTC](https://discourse.cmake.org/t/unable-to-include-header-files/1881/3 "2020-09-22T09:31:12Z")

</div>

Please ignore this question, I have rephrased it and will ask again as a different question.
