Jump to content

How to configure Static Linking in Visual Studio?

ClobberXD
Go to solution Solved by Unimportant,

For the standard runtime libraries provided by microsoft with MSVC:

 

Right click on your application (not solution) in the solution explorer and select properties.

 

Configuration properties -> C/C++ -> Code generation -> Runtime library:

Select eighter 'Multi-threaded' or 'Multi-threaded debug' depending on what you want in stead of 'Multi-threaded DLL' or 'Multi-threaded debug DLL'

 

For specific libraries you include yourself, consult the documentation of the library as you will probably have to do a static build of the library itself first.

I am interested in trying out static linking, and I'm using Visual Studio 2015. How do I enable this from the Project Properties?

 

Thanks!

Nothing to see here ;)

Link to comment
Share on other sites

Link to post
Share on other sites

is this so that you can use the exe program on different PCs?

 

in the "build" tab click configuration manager and change at the top left corner "debug" to "release"

NEW PC build: Blank Heaven   minimalist white and black PC     Old S340 build log "White Heaven"        The "LIGHTCANON" flashlight build log        Project AntiRoll (prototype)        Custom speaker project

Spoiler

Ryzen 3950X | AMD Vega Frontier Edition | ASUS X570 Pro WS | Corsair Vengeance LPX 64GB | NZXT H500 | Seasonic Prime Fanless TX-700 | Custom loop | Coolermaster SK630 White | Logitech MX Master 2S | Samsung 980 Pro 1TB + 970 Pro 512GB | Samsung 58" 4k TV | Scarlett 2i4 | 2x AT2020

 

Link to comment
Share on other sites

Link to post
Share on other sites

For the standard runtime libraries provided by microsoft with MSVC:

 

Right click on your application (not solution) in the solution explorer and select properties.

 

Configuration properties -> C/C++ -> Code generation -> Runtime library:

Select eighter 'Multi-threaded' or 'Multi-threaded debug' depending on what you want in stead of 'Multi-threaded DLL' or 'Multi-threaded debug DLL'

 

For specific libraries you include yourself, consult the documentation of the library as you will probably have to do a static build of the library itself first.

Link to comment
Share on other sites

Link to post
Share on other sites

8 hours ago, Unimportant said:

For the standard runtime libraries provided by microsoft with MSVC:

 

Right click on your application (not solution) in the solution explorer and select properties.

 

Configuration properties -> C/C++ -> Code generation -> Runtime library:

Select eighter 'Multi-threaded' or 'Multi-threaded debug' depending on what you want in stead of 'Multi-threaded DLL' or 'Multi-threaded debug DLL'

 

For specific libraries you include yourself, consult the documentation of the library as you will probably have to do a static build of the library itself first.

Can you tell me how 'Multi-threaded' and 'Multi-threaded debug' options differ? Thanks!

Nothing to see here ;)

Link to comment
Share on other sites

Link to post
Share on other sites

9 hours ago, Enderman said:

is this so that you can use the exe program on different PCs?

 

in the "build" tab click configuration manager and change at the top left corner "debug" to "release"

Yes, and also it's a breeze to just distribute one executable... (I myself don't know what DLLs I should distribute along with the .exe, any idea?)

Nothing to see here ;)

Link to comment
Share on other sites

Link to post
Share on other sites

13 hours ago, Anand_Geforce said:

Can you tell me how 'Multi-threaded' and 'Multi-threaded debug' options differ? Thanks!

https://msdn.microsoft.com/en-us/library/aa278396(v=vs.60).aspx

 

Options with 'debug' add debugging symbols and hooks to the compiled program so that you can use advanced debugging functions. Options without 'debug' are for release builds when you are done debugging, and the program is ready to be shipped.

 

Obviously, compiling with 'debug', will result in a slower, much larger executable, which is the tradeoff for the advanced debugging functionality.

 

Options with 'DLL' require external run time libraries DLL's, options without 'DLL' have the runtime library statically linked and can run on their own. This does not include any 3rd party libraries you use yourself, only the microsoft ones.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×