Well, this is a point-by-point essay by a peaceful student. Well, he has to understand how I developed Linux programs. What is the main work environment? The original problem is as follows:Q:
Teacher, can I write an article to introduce how to use vim to build a good linux development environment? For example, how can vim set shortcuts for one-click compilation and running, and how to install common plug-ins)
A:
I don't use vim, And I never use it.
Q:
I heard that in the actual project, you can write code in windows and then compile it in linux, but every time you change a file, you have to upload it to linux, which seems very troublesome, mr. Xiao can write an article about how to write software code in linux on windows? It mainly refers to how to manage files. Thank you.
A:
Well, I'll write an article on my work habits for you to see.My answer: Hello, peaceful classmate. Well, after reading your questions, I feel very careful, because few friends will develop the environment and raise questions separately. However, it is undeniable that, the first thing we encounter when developing software is the development environment. If this problem is not met, the subsequent development work will often be greatly affected, or even directly affect our work efficiency and effect. Therefore, this is indeed a topic that needs to be discussed carefully. Here, I will write an article to talk about my development habits. First of all, my development habits have many backgrounds and are a long-term development habit, I think it is easy to use. I believe many of my friends have their own development habits. I did not say that I am a holy decree and cannot be changed. You can fully combine your own work practices, summarize your habits. In a word: "sharing is good !" I started to learn about TurboC2.0 in C, which is something under DOS. for 90 years, we know that TurboC2.0 has an integrated development environment. Therefore, I started C Programs in the early stage, basically, I am used to working with IDE, including compiling and debugging. However, since 6502, I used the macro assembly language for development, and this is the end of the process. I cannot find a good development environment without IDE, and because it is a cross assembly, write code on a 5x86 machine, use the cross compiler to compile the code into 6502 binary code, and then upload it to the simulator. The simulator has a card that can be inserted into the real Nintendo game host, in fact, the ROM card part of the game machine is simulated. Then, the game machine Reset starts to work and the output result is displayed. This leads to a problem. I don't have an easy-to-use editor. For 96 years, I spent a lot of time. This usage point, that usage point, um, I used NotePad most, at that time, I wanted to cry. Fortunately, in 97 years, Microsoft will grade MSC7.0 and upgrade it to VC ++ 4.2. This is a classic generation, with support from both MFC and Win32, it is also the feature of IDE itself, which gives us an unparalleled and beautiful feeling. I fell in love with it. Go to this page immediately for development. Well, by the way, I officially went to work on Windows 95, at the end of 96. In the past, windows was not easy to use. It was mainly used in DOS. The VC4.2 IDE environment has the following advantages:
1. for project management, which language can be used to manage source code files, you can directly create a project for management. This is very convenient. I have a game of tens of thousands of lines and belong to hundreds of asm files, if you do not manage them, they will die.
2. Custom keyword High Brightness Display. This is very important. I am using a 6502 macro assembly. VC certainly does not have this keyword. However, I wrote a custom file, if you import it, it will be OK. It looks pretty and eye-catching. The key is that you are not easy to see it wrong. Well, there is a detail. I was still using the BASIC language, that is, VB. I am very familiar with the BASIC syntax. As I have said before, I used macros, I made a set of macros FOR THE BASIC language to easily write the assembly language. In my 6502 assembly language, it's all FOR, NEXT, PRINT or something, I also highlighted these Basic keywords, which looks nice.
3. for external compilation tools, VC certainly cannot do this 6502 cross-compilation. However, it provides a custom tool that allows one-click calls to external "bat" batch processing, realize the compilation, this is very convenient, ah, I intercept all its shortcuts into "Alt-F7", it is indeed very comfortable.
4. rectangular block copy is supported. Generally, the editor can copy only one or several rows in a row. However, when copying a struct, or when there are a lot of regular text, such as 0bug-C/C ++ commercial engineering road, the tasks in the task pool are generally defined as TaskInit because of the Three-Field Program theory, taskLoop and TaskExit are arranged as follows:
Static bool TravelTaskInitCallback (void * pCallParam, int & nStatus );
Static bool TravelTaskLoopCallback (void * pCallParam, int & nStatus );
Static bool TravelTaskExitCallback (void * pCallParam, int & nStatus );
Are you looking neat? However, the problem arises. If we only copy the content of TravelTaskxxxxCallback, It is very convenient to copy the rectangular block. This has never changed in VC, that is, to press and hold the Alt key to pull the block, then press Ctrl-C to copy the file, instead of having to copy three lines, and then pick and delete the file. This is also a very common function and is very convenient.
5. Most importantly, VC4.2 allows recording and playback of keyboard macros. This function is very important. In many cases, we need to input a large amount of content by using the copy and paste commands. However, what should I do if there is only one small difference between each pen of this large amount of data, but it is consistent with the law? This requires a keyboard macro. Here is an example. It may be a bit complicated. Let's take a closer look:
For example, if I enter Item000, Item001, and Item999 in the array, a total of 1000 such content will not be copied. My practice is as follows:
Code:
- 1. Prepare 10 rows of Item000 ~ Item009, each occupies 1 row
- 2. Copy 10 of the 10 copies, and there will be 100 copies.
- 3. I put the cursor on the second Item000, that is, it should be at Item010. Place the cursor at the beginning of the line.
- 4. What's important is that I start recording the keyboard macro and move the cursor to the second 0 position in Item000 a little bit. I replace 0 with 1 to get an Item010. Then, I move the cursor to the beginning of the next line. Then stop recording macros.
- 5. What did you find I did? I have obtained a keyboard macro, which can change the second 0 of Item00x to 1. At the same time, I carefully designed the cursor position so that after each macro is played, the cursor position is exactly the starting point of the next macro, which is very important.
- 6. Then, I played this macro nine times. For example, you can guess that I got Item010 ~ Item019 objects.
- 7. For example, change 0 to 1 and change 0 to 2. The 2x series will also be available until 9x.
- 8. Copy the 100 objects in 10 copies, and there will be 1000 objects. Each 100 internal units are in order, 000 ~ 099.
- 9. What's important is that I move the cursor to the second Item000, that is, the position of Item100.
- 10. Create a keyboard macro, change 0xx to 1xx, and repeat 99 times. The 1xx series will be fine.
- 11. For example, create 2xx ~ 9xx. The task is completed.
Do you feel tired? Well, it's actually quite easy. Of course, as a programmer, we still have a way to write a program to generate the above files. That's fine, but I didn't have enough skills at the time, well, I didn't expect a program approach yet. In addition, here we will discuss the use of pure input techniques to complete the input of a large number of similar data. I think this is a good skill. I think a good programmer should first be a good typist. After all, I have never heard of a company that configures a secretary and typist for every programmer. You have to input everything on your own. The above method is very important. I made "Sui Tang Romance", which contains the attribute values of hundreds of military commanders, which are close to 60 k data. I entered the data using the above method and completed it one morning. This directly led to my later evaluation of the program editor. First, I checked whether there was any keyboard macro function. No need to use it. It was strange that after VC6.0, multiple keyboard macro recording concepts were introduced, this makes the recording keyboard macro inconvenient. one-click recording and one-click playback are not supported. Therefore, I found the second tool UltraEdit32, which allows custom hotkeys for recording macros and playback on the keyboard. I usually use to define Ctrl-Q As the recording, ctrl-W indicates that the recording is finished, and Ctrl-A indicates that the recording is played once. Well, it also has A great benefit. Ctrl-L indicates the number of playback times. In this way, in the above experiment, I can write a 100 record directly, and then play back for 100 times, saving me a lot of trouble. Therefore, for so many years, I have been writing programs in the VSIDE + UltraEdit32 mode, basically enough. Well, when it comes to VSxxxxIDE, for example, I am using VS2008IDE. There is a tool that I can't help but mention. Visual Assist is essential. I didn't use it. After coming to Xi'an, recommended by colleagues here, this is a good stuff. It can automatically pop up all namespace-related information, such as methods and member variables in the class, for your choice, it is very convenient to compile class-based C ++ programs. Well, even in my basic development environment, it has not changed for so many years. When I arrived in Xi'an, the problem came when I mainly developed Linux programs. What should I do with vim? Haha. Later, I checked whether the. h and. cpp files are to be compiled by gcc. Which system did I write this file? What is the relationship? I am going to use VSIDE to organize projects and write files. Then, I opened an ftp service and an ssh service on the Linux server. After each compilation, I uploaded the ftp service to my home on the Linux server, and then finished makefile, the 0bug-C/C ++ road to commercial engineering tells a story about how to write Makefile. Of course, all files are going up. I putty, log on to ssh, and go to my home directory, make. Isn't it OK? As for the ftp tool, I don't actually use the commonly used Tom or something in the industry. I have always been used to using the NortonCommand tool. I started to use it from DOS. In Widnows, TotalCommand is now used, this tool is used to view the file F3), edit the file F4), copy F5) and transfer/rename F6. It is very convenient and used all the time. Well, from the beginning to the present, it has been around for more than 20 years. This TotalCommand has been supporting ftp since version 4.x. Although it is not perfect, it is enough to transmit some program code files. I have always used this tool. In fact, my development is so simple. The above several simple tools, coupled with some skills, will be OK. In this case, I have developed a habit. Every time I have completed the program, it is usually a F7 in VC. compile it first and then upload it to Linux for the second gcc make. Over time, the code I write always uses VC to compile and run the check, and gcc to compile and run the check. Therefore, 0bug-C/C ++ commercial engineering road says that my Engineering Library is cross-platform, it's not a joke. It's true that both platforms have run. In fact, it is three platforms. I have bought an arm9-test board, which is also a cross-compilation platform. In the Linux environment, I have to compile it using arm-linux-gcc, and then transfer it to run it, I did this:
Code:
- 1. Use VSIDE programming to create makefile.
- 2. Use a VM to run a Linux virtual machine. I generally like to use Fedora9 to install the arm-linux-gcc compiling environment.
- 3. ftp to home in linux
- 4. log on to putty and go to the directory to make
- 5. log on to the linux system using ftp from the linux console and upload the compiled executable file.
- 6. The arm small machine does not support ssh. I log on to the arm machine and run the program via telnet from the windows Super Terminal or the linux console.
- 7. Complete the work. Why don't you bother? However, this has also made some projects. My 0bug project library is verified under the arm machine.
It is so simple, because I have always used several tools that I am familiar with and have never changed to any platform, so the speed of hitting the program code is always constant and fast. This is not like some friends. When it comes to Linux, we have to use vim or something, but vim is old. Some functions of the modern program editor, such as keyboard macros, have poor support and many need to be configured, programming is very troublesome. I am a programmer and writing a program is the top priority. I didn't have much time to learn tools, so I didn't learn it. Well, however, some of my colleagues in my previous project team insisted on using vim. I didn't say anything. After all, what tools are used as their own freedom. When they compile programs, the ten-finger Avatar butterflies fly on the keyboard and look pretty. However, the efficiency is too low, and the error rate is high. In many cases, the project progress is affected. I advise them later that there is no need to be cool-it is better to use VC, they gradually changed to my habits, and now the efficiency is much better. That's simple. There is also a place to remind everyone. In VC, we have a very convenient debugging tool and what to track in a single step. However, unless gdb is used in gcc, it is basically useless. This is troublesome. I still don't know if the arm9-machine does not support gdb. In fact, I have never learned gdb. Why? I think it is not easy to use. In fact, from the abstract point of view of program debugging, I think it is not complicated to decide and design and check the median value.
1. The so-called design means that the programmer needs to precisely control his or her own program ideas, which step should be taken, what value should a variable be, and be aware of it so as to determine whether the program runs correctly or not.
2. The so-called check means that the programmer must have the means to "see" The Middle Value of the variable to compare right and wrong.
Let's think, is that true for program debugging? It is hard to say that the design depends on the programmer's own capabilities, but there are too many ways to "see" and there is no legal regulation, you must rely on the IDE development environment to "see" The Middle Value of the variable. My colleagues and I generally use the "print-big-method, this article describes 0bug-C/C ++ commercial engineering. I thought I spent two chapters in the book and made a Debug class and a Syslog class, the debugging tool is used to print the median of the variables you are interested in to the screen or disk at any time, so that you can compare the variables and check for bugs.
This Debug class is even the basis of the entire project library. It is the underlying class and its objects are instantiated when processes are moved together. After all other modules exit, the structure is analyzed, its importance is self-evident.
To be honest with everyone, although I have been using VCIDE for development for so many years, I have never relied on F9 or F10, basically, debugging is based on your own Debug class. The reason is simple. I am working on high-speed servers, high-performance data kernels, parallel systems, and systems. When the system is running, hundreds of thousands of packets on the network are running at any time, dozens of hundreds of threads and processes, even when the service is working, many times, the bug is the result of so many factors affecting each other, rather than a bug in a single program. I ran to the single-step tracking, and this sentence was not completed, hundreds of signaling signals on the other side have passed. It can be said that when I saw a site, it was declared invalid. I always said that the single-step tracking is invalid in Parallel Environment debugging, this is the truth. What should we do? "Print-big-method" refers to "print-big-method". It does not affect the work of the program during running, and does not interrupt or block it. All the variables are printed into the log file and analyzed afterwards. It can be said that, I have analyzed and solved debug in recent years, and I certainly cannot use single-step tracking. This is why I never learn gdb, because it is useless. Well, when I have a well-developed environment for program input, and my engineering database also provides a well-developed self-validation mechanism, do you think it is hard for me to develop cross-platform applications? Haha. The above is my own experience, including my own development. Well, now I am working on a computer with HashCache, which is the work mode development mentioned above. I am used to it, fast. Well, let's talk about it first. If you have any questions, you can ask again. ========================================================== ====================
Buy 0bug-C/C ++ commercial engineering at the reserve price online
Directly click the link below or copy it to the address bar of the browser)
Http://s.click.taobao.com/t_3? Limit % 3 Fpid % 3Dmm_13866629_0_0 Xiao Miao
This article from the "Xiao blog" blog, please be sure to keep this source http://tonyxiaohome.blog.51cto.com/925273/304769