# Unable build dll

**URL:** https://discourse.cmake.org/t/unable-build-dll/2327
**Category:** Code
**Created:** [December 9, 2020, 4:37pm UTC](https://discourse.cmake.org/t/unable-build-dll/2327 "2020-12-09T16:37:12Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Andry](https://discourse.cmake.org/user_avatar/discourse.cmake.org/andry/32/1012_2.png) [@Andry](https://discourse.cmake.org/u/Andry)
#### Post date: [December 9, 2020, 4:37pm UTC](https://discourse.cmake.org/t/unable-build-dll/2327/1 "2020-12-09T16:37:12Z")

</div>

LINK : error LNK2001: unresolved external symbol \_DllMainCRTStartup

cmake version 3.18.20081302-MSVC\_2  
and  
cmake version 3.16.5

_CMakeLists.txt_

```cmake
cmake_minimum_required(VERSION 3.16)
project(testttttt)

include(GenerateExportHeader)

add_library(mylib SHARED Export.h)
generate_export_header(mylib)
set_target_properties(mylib PROPERTIES LINKER_LANG

```

_Export.h_

```auto
#include <string>

#include "mylib_export.h"

MYLIB_EXPORT int Export(const char* data_c, size_t size){
    std::string http_data(data_c, size);
    return 333;
}

```

---

<div class="post-metadata">

### Author: ![fenrir](https://discourse.cmake.org/user_avatar/discourse.cmake.org/fenrir/32/734_2.png) [@fenrir](https://discourse.cmake.org/u/fenrir)
#### Post date: [December 9, 2020, 5:00pm UTC](https://discourse.cmake.org/t/unable-build-dll/2327/2 "2020-12-09T17:00:29Z")

</div>

You need a source file. Header file by itself will not cut it.
