premake5: how to set runtime library to Multithreaded DLL (/MD) in vs2015

multithreaded dll vs multithreaded
multi threaded debug dll mdd
premake5 runtime
/mt vs /md
mtd flag
vc md
msvc static link
static link msvcrt
kind "SharedLib"
language "C++"
defines "DLL_EXPORT"
targetname "read_cad_file"
targetextension ".arx"

I am developing using objectARX, and I want to compile my project using premake5 and vs2015. Some of the settings in the script is as the above. Under this setting, in properties->C/C++->Code Generation->Runtime Library, the runtime library is Multithreaded Debug(/MTd). I would like to ask how to change it to Multithreaded DLL (/MD) using premake5? Thanks a lot:)

The key you are looking for is staticruntime. While it should be off by default, you can also turn it off explicitly

As in

staticruntime "Off"

/MD, -MT, -LD (Use Run-Time Library), Remarks; See also. Indicates whether a multithreaded module is a DLL and specifies retail or debug versions of the run-time library. To set this compiler option in the Visual Studio development environment. Open the  All modules passed to a given invocation of the linker must have been compiled with the same run-time library compiler option (/MD, /MT, /LD). For more information about how to use the debug versions of the run-time libraries, see C Run-Time Library Reference. For more about DLLs, see Create C/C++ DLLs in Visual Studio.

   configuration "Debug"
      buildoptions "/MDd"
   configuration "Release"
      buildoptions "/MD"
   configuration {}

staticruntime, Extracting "premake5.lua" with premake for vs2015 solution "SQLite3" with Release AES256 - Win32, Multithreaded DLL (/MD) 1>wxsqlite3.lib(​sqlite3secure.obj) : error LNK2001: unresolved external Is there something I'm doing terribly wrong in my setup? Multithreaded-DLL runtime is the default. premake5: how to set runtime library to Multithreaded DLL (/MD) in vs2015 The key you are looking for is staticruntime. While it should be off by default, you can also turn it off explicitly As in staticruntime "Off"

I don't know about the static or DLL versions of the runtime. But debug and release should be switchable by the runtime keyword. See:

https://github.com/premake/premake-core/wiki/runtime

compiling & using wxSQLite 3.5.8, Compiled couple of .dll's using visual studio 2015, and tried to deploy on to /MT​|/MD (Multi-Threaded CRT DLL Release|Debug) runtime library choice If you're using premake5 you can configure your project like this: defines 2) Link against the runtime statically (/MT or C/C++ -> Code Generation -> Runtime Library:  2 premake5: how to set runtime library to Multithreaded DLL (/MD) in vs2015 Feb 7 '19 1 How to implement QML ListModel like get method for an QAbstractListModel derived model Mar 9 '18 View all questions and answers →

So, my project isn't a shared lib, but an exe.

What I added was the following to the 'filter' section:

filter "configurations:Debug"
    architecture "x86_64"
    links {"libprotobufd"}
    defines {"DEBUG"}
    symbols "On"
    libdirs { baseLibPath .. "debug" } -- baseLibPath was defined elsewhere
    postbuildcommands {}
    debugdir "$(TargetDir)"
    flags {"staticruntime"} -- this is what worked for me

I'm not sure if that will solve your problem, but give it a go?

I'm still relatively new to premake, so take this with a grain of salt.

Visual studio 2015 run-time dependencies or how to get rid of , Linking with C-Runtime Library statically. Create issue 1>MSVCRT.lib(​MSVCR100.dll) : error LNK2005: "public: thiscall if I compiled the libraries with /​MT and /MTd, rather than /MD and /MDd? If you insist on this however, you can edit the Premake scripts in the SDK to add the `StaticRuntime` flag to  I am using premake5 alpha 6 on Windows. The problem originated when I found that my Visual Studio project's "Runtime library" settings was set to Multi-Threaded DLL /MD in Debug mode, instead of Multi-Threaded Debug DLL (/MDd). Upon investigation, I found that the project file Debug configuration was set to UseDebugLibraries = false.

project "read_cad_file"
  kind "SharedLib"
  language "C++"
  defines "DLL_EXPORT"
  targetname "read_cad_file"
  targetextension ".arx"
  files "*.cpp"
  files "*.def"
  files "*.lua"
  sysincludedirs "../../../third_party/object_arx/inc-x64/"     
  sysincludedirs "../../../third_party/object_arx/inc/"
  includedirs "../../../third_party/object_arx/inc/"
  includedirs "../../../third_party/object_arx/inc-x64/"
  libdirs "../../../third_party/object_arx/lib-x64/"
  links "ac1st22.lib"
  links "acad.lib"
  links "accore.lib"
  links "acdb22.lib"
  links "acge22.lib"
  links "acgiapi.lib"
  links "acui22.lib"
  links "adui22.lib"
  links "advapi32.lib"
  links "rxapi.lib"

This is the full premake file.

Linking with C-Runtime Library statically, premake5: hogyan lehet beállítani futásidejű könyvtár többszálú DLL (/ MD) a Nem tudom, hogy a statikus vagy DLL változatai a futás során. De hibakeresés és a felszabadulás legyen kapcsolható a runtime kulcsszó. configuration "​Debug" buildoptions "/MDd" configuration "Release" buildoptions "/MD" configuration {}. I was able to solve this by setting the C/C++ > Code Generation > Runtime Library compiler option . For Debug: from /MDd to /MTd; For Release: from /MD to /MT; This removed all the API-MS-WIN-CRT-* and runtime dll references and caused all the CRT code to be statically linked.

premake5: hogyan lehet beállítani futásidejű könyvtár többszálú DLL, Creating conan packages to install dev tools . bin # Copies all dll files from packages bin folder to my "bin" folder To keep the package configurable for supporting static(MT)/dynamic(MD) linking with the VS runtime library, you code and a build folder with a Visual Studio 2015 solution, containing 2. LNK2038 mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MD_DynamicRelease' in Garch.obj. I'm using VS 2017 Community on Win10. I've checked all the .cpp files properties and all the Runtime Libraries are set to Multi-threaded DLL (/MD) in the C++ All Options options.

[PDF] Conan Documentation - Conan docs, How many times have you see the linker error "symbol already defined" or DLL (/MD), Multi-threaded Debug (/MTd), and Multi-threaded Debug DLL (/MDd). set of library files contains all the symbols in C/C++ standard library. However, win32fe does not let you choose which runtime library to use. By using our site, you acknowledge that you have read and understand our

How to Compile and Link with Visual C++, If that property is not set then CMake uses the default value MultiThreaded$<$<CONFIG:Debug>:Debug>DLL to select a MSVC runtime library. Note This variable has effect only when policy CMP0091 is set to NEW prior to the first project() or enable_language() command that enables a language using a compiler targeting the MSVC ABI.

Comments
  • You are still on the Debug configuration, switch to the Release configuration.
  • Can you explain how and why these options will solve OP's problem?
  • I tried the keyword runtime before, but it doesn't work.
  • Post the full premake file then. If it really "does not work" you should file a bug at the premake project.
  • I post the full premake file in the answer below, thanks!