How to compile a static library? (“-static-lib…” equivalent?)?

Load your project in Visual Studio Right click your project and choose Properties Locate the "Linker" portion of the tree on the left Choose All Configurations and All Platforms from the drop down menus at the top of the dialog Put your additional static library dependencies in the Input -> Additional Dependencies field, semicolon delimited If the libs are not on your lib search path, make appropriate entries in the General -> Additional Library Directories field, semicolon delimited Apply, save, compile, run.

Load your project in Visual Studio. Right click your project and choose Properties. Locate the "Linker" portion of the tree on the left.

Choose All Configurations and All Platforms from the drop down menus at the top of the dialog. Put your additional static library dependencies in the Input -> Additional Dependencies field, semicolon delimited. If the libs are not on your lib search path, make appropriate entries in the General -> Additional Library Directories field, semicolon delimited.

Apply, save, compile, run.

I.imgur. Com/Oqx9R. Png – ibiza Nov 11 at 23:01 @ibiza Sorry... some names were wrong as I was typing from memory... editing now.

– Michael Price Nov 11 at 23:02 Also, these are the instructions for adding a dependency on a library. If that static . Lib is paired with a .

Dll, the . Dll will have to be on your runtime executable search path (most likely should be in the same directory as the executable). – Michael Price Nov 11 at 23:05 I have already all of these settings, but somehow it still seems to try to use the dll?

Thinking of it, maybe it's because I filled the Reference Directories in the Configuration Properties -> VC++ Directories section? Edit: just removed the path for References and it changed nothing – ibiza Nov 11 at 23:06 My guess is that the . Lib you are linking against is just an import library for the DLL in question.

By linking against it, you are requiring that the DLL be loaded into your application at executable load time (instead of delay loading via LoadLibrary). See msdn.microsoft.Com/en-us/library/windows/desktop/… – Michael Price Nov 11 at 23:18.

You can't use dll as a static library ( that's why they are called Dynamic-link library ). In order to compile a static library, you'll the source code of that library. Once you have the source code, go to Project settings, General->Configuration Type and set it to Static Library(.lib).

Then in your program, you'll need to add that library by putting the library name in Linker->Input->Additional Dependencies.

Okay, I already did that too, I have both dll and library correct settings in my project properties. How can I indicate to my program to use the static versions? – ibiza Nov 11 at 23:03 You don't need to.

Just include that library name in Linker->Input->Additional Dependencies and include the header files, and use the functions. – JosephH Nov 11 at 23:05 Refer to msdn.microsoft. Com/en-us/library/ms235627.

Aspx for the complete steps – JosephH Nov 11 at 23:06 hmm...well I have all these settings correct and it still wants the dynamic dll file :( – ibiza Nov 11 at 23:10 Be sure to read the documentation of the external library that you're using. Libraries will have different function declarations for dynamic libraries and static libraries. For example, if you want to link Curl statically, you need to define CURL_STATICLIB or XERCES_STATIC_LIBRARY for apache xerces etc.– JosephH Nov 11 at 23:13.

The two flags passed to gcc as per your question tell gcc to link the runtime library statically to an executable or shared library/dll. This is unlikely to be the problem with your issue as the part of the error message you quoted suggests that ExternalCLibrary. Dll isn't being built properly.

If the DLL exists, use a tool like dependency walker to determine which dependency of your DLL can't be loaded; that's the likely culprit. If ExternalCLibrary. Dll doesn't exist then you need to find out where you are supposed to get it from, but if your project builds and it's listed in the project as a dependency then my guess is that it's an issue with the loader not being able to find a dependency of this DLL at runtime.

ExternalCLibrary. Dll is built correctly as if I add the path where my dll is to the PATH environment variable, the whole application works. – ibiza Nov 11 at 23:09 That would make sense, because the loader checks the path variable for DLLs that aren't in the current directory.

You might want to consider configuring your project so all dependent DLLs end up in the same directory as the main application to avoid this issue. – Timo Geusch Nov 12 at 0:38.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions