_ Gun_source macro

Source: Internet
Author: User
Tags lstat

Problem description: an error and a warning are prompted during program compilation.

Error: storage size of TZ isn' t know; tz Is a variable of the struct timezone type.

Warning: Implicit declaration of function lstat;

 

Check the man manual and find that TZ needs to add sys/time. h header file. sys/lstat must be added to lstat. h header file, but these two header files are already included.

 

Inadvertently found a solution, added-d_gnu_source (definition _ gnu_source macro) during compilation, so as to do it, the program compiled through. Continue to understand the _ gnu_source macro and find it in features. H is a function test macro used for property control, and the two header files mentioned above are sys/time. h, sys/STAT. h contains features. h file.

 

</User/include/features. h>

/* If _ gnu_source was defined by the user, turn on all the other features .*/

# Ifdef _ gnu_source

# UNDEF _ isoc99_source

# DEFINE _ isoc99_source 1

# UNDEF _ posix_source

# DEFINE _ posix_source 1

# UNDEF _ posix_c_source

# DEFINE _ posix_c_source 200809l

# UNDEF _ xopen_source

# DEFINE _ xopen_source 700

# UNDEF _ xopen_source_extended

# DEFINE _ xopen_source_extended 1

# UNDEF _ largefile64_source

# DEFINE _ largefile64_source 1

# UNDEF _ bsd_source

# DEFINE _ bsd_source 1

# UNDEF _ svid_source

# DEFINE _ svid_source 1

# UNDEF _ atfile_source

# DEFINE _ atfile_source 1

# Endif

 

Among them, _ isoc99_source, _ posix_source, _ xopen_source are both function test macros used to indicate whether the corresponding standard features are included. These different features are derived from various standardization work (ANSI, ISO, POSIX, FIPS, etc.). Different standards support different features, such as obtaining system time. The stat structure is not supported in ANSI standards, the definition of _ gnu_source is equivalent to enabling support for all features.

 

Another problem: when the program is running, MMAP is prompted.Error. Error Code 22 (invalid argument).

My working directory is a directory on the Windows desktop. It is shared to Linux using virtual machine tools, and MMAP ing files are also in this directory.

 

I suspect that the VM memory is insufficient. After reading freemem, the memory is sufficient. After the machine is restarted, the same problem still occurs. Copy the code to the machine (64 bit) in the data center and compile and run it properly. It is assumed that the mapped file is not a file in the system, causing the ing to fail. Therefore, the ing file is copied to the Home Directory, which works properly. I cannot explain the principle clearly. Can I enable memory ing when opening a file theoretically?

 

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.