In my VS2010 Visual C++ project, I need to add a few Windows libraries to access socket functionality. I know how to add a library to executable project (Properties --> Linker --> Input); I do not see the same option when I change my project type to "Static Library". How do I add windows libraries to a Static Library output project?
Help is greatly appreciated.
Related
I am trying to call a function found in a static lib (xxx.a) from a Visual Studio Express 2013 project.
(The static lib is the output of a C project, compiled in IAR workspace).
In my Visual Studio project I added the library folder location to the VC++ directories (both under include directories & library directories), and under linker->Input->additional dependencies I added the library itslef (xxx.a ).
When I compile the project, I get a linker error:
C3861 (identifier not found).
What am I missing? I am newbie as it comes to library usage, so any help would be greatly appreciated.
Visual Studio 2013 cannot read .a format static libraries. Even if it could, the static library is surely not linked against the same version of the C library as you're trying to build against.
I am trying to port a (very) old project of mine from Visual Studio 6 to Visual Studio 2010.
The project is an OpenGL application, and as such, it uses the following libraries (amongst others):
glu32.lib
glui32.lib
glut32.lib
opengl32.lib
The glui32.lib library links the libcd.lib library, which is not supported on Visual Studio 2010.
So I need to find a version of the glui32.lib library, which links the libcmtd.lib library instead.
My questions are:
Is there any such version of the glui32.lib library?
If yes - where can I download it?
If no - can I use the libcd.lib library on Visual Studio 2010?
If yes - where can I download it?
If no - is there any other way for me to solve this linkage error?
UPDATE
I'm leaving the answer below as the accepted one, but here is a workaround for porting an OpenGL project from Visual Studio 6 to Visual Studio 2010 (after creating the project in Visual Studio 2010):
Right click the project and choose Properties.
Open Configuration Properties --> C/C++ --> Preprocessor.
In the Preprocessor Definitions entry, add GLUT_BUILDING_LIB.
In the Runtime Library entry, choose Multi-threaded (/MT) or Multi-threaded Debug (/MTd).
Open Configuration Properties --> Linker -->Input.
In the Additional Dependencies entry, add glu32.lib;glui32.lib;glut32.lib;opengl32.lib.
In the Ignore Specific Default Libraries entry, add libcd.lib.
You can rebuild GLUI. The MSVS project they ship converts without issue to VS2010.
You will have to point it at your GLUT build though.
My Development Environment is
C++
Visual Studio 2008
Windows 7
I'm going to start a project (MFC application) and final result (exe) should run on windows xp, vista ,windows 7 or windows 8 without installing any extra packages (like Visual C++ Redistributable package).
Questions:
Which kind of project I should select in visual studio?
What are the project settings I should specify?
You have to use MFC as a static library. Pay attention in project creation wizard for this option.
These are the basic things you have to consider when you start a project in Visual studio that need to run in target computer without installing any other redistribute components.
You have to select project type Win32-> Win32 Console Application or Win32-> Win32 Project as your console or GUI requirements.
You must select No Common Language Runtime support in right click project in solution explorer -> Properties -> General -> Common Language Runtime support
Your application need run-time assemblies to run in target computer. There is two methods to deploy run time DLLs in target computer
Assemblies link statically ( right click project in solution explorer -> Properties -> General -> Use of MFC and Use of ATL). but if your application combine with multiple DLL EXE and LIBs, this method is quite troublesome.
Deploy Runtime DLLs in target computer as private assemblies (I personally recommend this method). More details here
Expanding upon what's already been said..
You need to set the project to build as a static library:
Right click the project
Go to "Properties->Configuration Properties->General->Project Defaults->Use of MFC" set to "Use MFC in a Static Library"
You may also need to turn off the /MD flag if you're using it, and swap it out for '/MT' instead:
Right click the project
Go to "Properties->Configuration Properties->C/C++->Code Generation->Runtime Library" set to "Multi-threaded /MT"
I am creating a sample project (a Hello, World!) with libevent.
(Just for note: This question has got nothing to do with libevent but with Visual Studio. :-))
I compiled the library separately outside but under Visual Studio environment.
Wanted to test with a sample code and I started with creating a new project in VS2010.
I selected Visual C++ --> General --> Empty Project.
When I selected the project properties to add the 'additional include directories' I do not find
C/C++ node where it is usually added.
This is how it looks:
However, when I select Visual C++ --> Win32 --> Win32 Console Application I will be able to see the C/C++ node and add the additional include directories.
I read this post and understood I can add the required directories in VC++ Directories --> Include Directories. But yet it's not so very advisable to change the default setting.
Is there any other way I can add additional include directories without selecting the C++ --> Win32 --> Win32 Console Application project? Just want to know.
You need to have at least one .cpp file added to the project to be able to see the C/C++ settings. Otherwise, being an empty project, VS does not know what language you are using
You have to have a C++ project. It doesn't need to be a console application; you could also create a static library (.lib) or dynamic library (.dll).
I would like to build a shared object/shared library (.so) by using Visual C++. I chose project compile type: static library
However this way it builds a .lib file. Is it even possible to build unix shared librarys with Visual C++?
The Windows name for a shared library is Dynamic Link Library (DLL).
In "Win32 Application Wizard" choose Application Type: DLL