I heard that I can create a .lib file in Visual C++ 2010 Express. I've created a new project, -> Win32 Project -> Static Library. Now, the IDE gave me a lot of files that are meaningless to me. For instance, at "External Dependencies" tab I have a file, called sdkddlver.h, in Header Files tab I have 2 headers: stdafs.h and targetever.h.
I just want to create a few functions and to export them as a .lib file. Also, I want to create a header file which should have the prototype of that functions. How can I do that? I know that I have to create a .cpp file (must be an executable) but I can just put the functions in that file? Without any declarations or something? Why do I need all those files that IDE gave me, named above???
I can't say for VS210 express, but in VS2010 pro you open the properties for your project, and in configuration properties under General, change the configuration type from application (.exe) to static library (.lib)
When you compile your code you'll have a lib file in either the release or debug folder, and the (your project name).h file that you have written.
The other files VS2010 creates by itself, a google or MSDN/help of the filenames will give you help on those.
Look, all I want is just to create that .lib file with my functions in it. I know that a .lib file contains a colection of functions. I really know that.
The thing is that when I build that main.cpp with my functions in it, I get the error below, I DON"T TRY TO EXECUTE A .lib FILE, I WANT TO CREATE IT.
And, as far as I understood, I can create a .lib file by building a cpp file (with my functions in it), placed in a Win 32 project (static library). I don't understand why is so unpleasant to create something so simple.
I've been messing with this problem for a few days and I can't figure it out.
Look, I don't like to stress you by repeating all those things over and over again. I don't like that either. But I am requesting you respectfully, to help me with that because is very important to me. If I figure this out, I won't stress you anymore, I promise.
The idea is this. Your source files will have .c extensions of C programs and .cpp extensions for C++ programs. You add these source files to the project. When you build it, it generates a .lib file, which is your static library.
So you wouldn't expect to add a .lib file, as that is what is generated.
When I asked, "Have you actually put your code in the project and built it?" I would expect you to add source code files with .c or .cpp extensions and optionally header files.