Windows under vc++6.0 Making , working with dynamic libraries and static libraries
First, vc++6.0 making and using static libraries
static library production
1. a new one in vc++6.0 for the Win32 Static Library Project and create a new . cpp and a . h(c++headerfile) files
2..cpp program directly according to the teacher to fight, notice here need to change the wrong, remove (Long)
3. The. h file needs to be written in its own format as follows. Taking head.h as an example
#ifndef _head_h_
#define _head_h_
unsigned long unsgn_pow (unsigned int,unsigned int);
#endif
4.Build
5. a . lib file is generated in the root Debug folder This is the static library we want .
Static library use
1.new a normal blank test CPP file (do not create a new project or you will get an error). Enter the test code. The simpler the test code, the better, the more
The teacher gave the code anyway I didn't read it. I changed the value of the assigned code to enter X, Y.
#include <stdio.h> #include <stdlib.h> #include "head.h" int main (void) {unsigned int x, y;unsigned long res;printf ("Ple input 2 number (int) \ n");scanf ("%d%d", &x,&y);Res =unsgn_pow (x, y);printf ("%u ^%u=%u\n", x, Y, res);Exit (0);}
2. include (#include "head.h") in the test code
3. Add the. lib file that you generated in the object/library module, input---.
(There are countless errors that should be made at once) here are some incorrect debugging methods.
There is no object/library module in the connection bar prompt for Lib not found
You may need to set the correct reference path in Tools/options
vc++6.0 authoring, using dynamic libraries and static libraries under Windows