When the compiled program does not even enter the main function entry
Source: Internet
Author: User
A very strange thing is that a program runs well clearly. After a while, it will run again and find that only information about the global class constructor is printed, the first sentence of the main function is not printed (the printf added by myself). What is the situation... Immediately ruled out all possibilities, code review, no exceptions found, just some of the changes to restore, re-compile, poor cygwin turtle speed, waiting for several minutes. Or not. This is speechless .. I began to doubt the external audio. there is a problem with the dll library, because it only prints the information in its global class constructor and exits, but think about it wrong, because the library was running well before... I suspect it is too unscientific. I doubt another Dahua SDK library, because it is not running normally all the time, but the function in its SDK will not be executed even if the main function is not included, except for the global class variables, the class variables are constructed. Exclude it... This database cannot be excluded! This is really depressing. I want to carry forward the spirit of the tortoise. Let's put it first. Maybe it will be okay suddenly .. Later, I accidentally opened the task manager and found several GDB processes. When I looked at the process and turned it off, I suddenly remembered that I was just using GDB to debug the program. Will it be related to this. Run the program again immediately. The familiar logs are running like the cloud. It is normal .. Tears .. After running GDB in cmd, I secretly stuck in the memory and refused to leave. You must manually turn it off. A waste of one hour, coupled with an hour of experience. Conclusion: When GDB is opened in Windows, it must be switched off from the task manager. If this kind of function is not connected to the main function, only the abnormal event of global class construction information is printed. First, check whether there is a copy of the program or GDB running in the memory.
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