PATH Ldflags CFLAGS

Source: Internet
Author: User

CFLAGS represents an option for the C compiler.
Cxxflags represents options for the C + + compiler.
These two variables actually cover the two steps of compiling and assembling.

Let's look at a few related environment variables: PATH, Ldflags, CFLAGS

PATH: Everyone should be familiar with it. After installing a package, it is possible to create a bin directory in the installation directory, in which there are executable programs, which we need to add to the PATH environment variable in order for the system to find these programs. Here's how to join.

Ldflags: Some of the optimization parameters used by the compiler, such as GCC, or the location of the library files can be specified. Usage: ldflags= "-l/usr/lib-l/path/to/your/lib". Each installation of a package will almost certainly create a Lib directory in the installation directory. If you install a package clearly, and install another package, it Leng said can not find, then the package of the Lib path to join the Ldfalgs to try it.

CFLAGS: Similar to Ldflags, but to Rigaru is the path to the header file (. h file), such as: cflags= "-i/usr/include-i/path/to/your/include". Similarly, when a package is installed, an include directory is created under the installation path, and when a problem occurs during the installation, try adding the Include directory of the previously installed package to the variable.

So how do you add these paths to those variables? Take the path variable as an example.
one way is to: Directly below the command line:
$ path= "$PATH:/path/to/your/bin:/another/path/to/bin"
$ Export PATH
The advantage of this method is convenient, immediate effect, the disadvantage is that the current session or shell closed after the failure, the next time you have to run again.

Another way is to: Add the following two lines of content to the ~/.BASHRC file, if you want it to affect the entire system and not just the current user, add the following to the/ETC/BASH.BASHRC (remember that the system is/ETC/BASHRC this file)

PATH="$PATH:/path/to/your/bin:/another/path/to/bin"
Export PATH

Then, restart the shell.

It is important to note that the delimiter of the PATH variable is: number, the other is a space,
So ldflags should be like this:
ldflags= "$LDFLAGS-l/path/to/lib-l/path/to/lib"
Cflags should be like this:
cflags= "$CFLAGS-i/path/to/iclude-i/path/to/include"

PATH Ldflags CFLAGS

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.