8.19 create a dynamic Vim ide static library

Source: Internet
Author: User
Vim configuration file location:/Etc/Vim/vimrc ~ /. Vimrc

Steps for creating an ide

, Ta, NN Testing
Use large ide


, Da generation documentation description, DD generation function description
, JD jump function, O closes other windows, BF displays the list of opened files

Use of GCC parameters:



Create a dynamic library and a static library in Linux. The file structure is shown below:


Create a static library. The static library ends with.:
Generate static library files using makefile in SRC
 
 
  1. libcalc.a:
  2. gcc -c *.c
  3. ar rcs libcalc.a *.o
  4. mv libcalc.a ../lib
  5. clean:
  6. rm -rf *.o
  7. rm -rf libcalc.a
  8. rm -rf ../lib/libcalc.a
The MAKEFILE file of Main. C is used to link the static library and run
 
 
  1. all:
  2. GCC main. C-iinclude lib/libcalc. A-O app //-iinclude is the address of the specified header file
  3. clean:
  4. Make-c src clean // make-C is to enter the src directory and execute the "make clean" command of SRC.
  5. rm -rf app
Another method: You can use the GCC-C main. C-iinclude command to generate a main. o file and then compile the GCC main. O lib/libcalc. A-O app and the static library together.

Create a dynamic library: the dynamic library ends with. So
Generate a dynamic library file using makefile in SRC
 
 
  1. libcalc.so:
  2. gcc -fPIC -c *.c
  3. gcc -shared -W -o libcalc.so *.o
  4. mv libcalc.so ../lib

Link the dynamic library to generate the executable file GCC main. C-iinclude-L./lib-lcalc-O app
Explanation:-L./lib specifies the directory where the library is located-The lcalc library name is libcalc. So-L is short for Lib, so can be omitted, So-lcalc
Unfortunately, the following error is reported:

LDD./APP: No dynamic library found


How to find the dynamic library: What the instructor taught
At this time, you need to modify/etc/lD. So. conf and add the lib directory to it with the root permission.

Then, run sudo ldconfig and then LDD to see the dynamic library.

Then you can execute it.


Another way to find the dynamic library:
Linux does not search for executable programs in the current directory, nor does it look for the so library files in the current directory earlier
How to modify the user configuration file

1 cd

2 VI. bash_profile (under Ubuntu, It Is. Profile)

3 Export LD_LIBRARY_PATH = $ LD_LIBRARY_PATH:. This is more difficult, = no space on both sides

4. Save and exit

5. bash_profile





Static library error cause nm view library files
You can use the NM command to view the symbol table of a database, so that you can view the errors in it.


From Weizhi note (wiz)

8.19 create a dynamic Vim ide static library

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.