C ++ is widely used in computer programming languages and can help us easily meet various functional requirements. For example, the implementation of the C ++ cross-platform application introduced today can be implemented in a simple way. I hope to help you.
It is also difficult and easy to build a C ++ cross-platform application.
What are the difficulties? The so-called application is a practical application and involves a wide range of topics.
As we all know, different operating systems may have the same functions in real time. For example, parameters and returned values have different definitions (socket), and even different semantics (sleep. If you need to maintain the difference on your own, you must write the following code:
- #if defined WINNT
- #elif defined LINUX
- ...
This is definitely a huge project. As for how big the project is, you can take a look at ACE development costs. This is hard!
- Tips for compiling Visual C ++ applications
- Introduction to C ++ function pointers
- Summary of C ++ TinyXML usage
- Two types of C ++ Data Pointer
- Introduction to the specific application functions of C ++ File Operations
In order to implement C ++ cross-platform applications, I want to find a cross-platform library that has been proven to be usable by everyone, and build it on the shoulders of giants, this job becomes easy. Some of my options are listed one by one below:
0. Language and base library:
Standard C ++ and boost
The standard c ++ was developed in 98 years. Currently, the mainstream c ++ compilers support it well. VC7.1 and GCC4.0 and later are recommended. Boost is a set of C ++ libraries built up by a group of C ++ standards committees. Many of these libraries are imported into C ++ TR1, which can be said to be quasi-standard. We have a good reason to use the library here. For String-like operations, you can use the boost String algorithms library. for formatting operations, you can use boost: format and the regular expression boost: regex. Boost content is quite rich, please refer to the specific content of the http://www.boost.org/libs/libraries.htm here there is a list of boost library.
1. Operating System related:
ACE (ADAPTIVE Communication Environment) and boost
ACE encapsulates the mutex, signal, process, and thread related to the operating system and can be used directly. However, if no ACE is used, not every program is related to the network. If no ACE is used, it may not be used. At this time, you can consider using the corresponding boost class thread: thread, Boost.: Process, etc.
2. Network
ACE
ACE is very good for network applications. In addition to simple packaging for heterogeneous platforms, there are also design models to cope with various environments. It can even be said that C ++ is currently the only choice for cross-platform network programming. ACE also provides packaging for high performance requirements such as IOCP (winnt) or EPOLL (linux2.6.
3. Database
OTL (Oracle, Odbc and DB2-CLI Template Library)
To support databases, we must not only use C ++ cross-platform applications, but also cross-database applications. Is it more ideal than you think. OTL supports the following databases: OTL Oracle, SQL Server, Access, and MySQL. There are other libraries such as DTL, but I think this library not only supports ODBC, but also supports native database interfaces, which can provide better performance.
4. Interface
QT, wxWidgets
Although I have been using MFC for many years, I still hate the countless macros of MFC. Although wxWidgets is good, its style is obvious. Use QT. object-oriented programming is quite pleasant. However, QT is a two-way authentication. If your program is free of charge, it will be free of charge. If your program is going to sell money, it will also need it, and the price is very high. Therefore, wxWidgets can be considered for copyright and cost considerations.
I have listed many things and hope to help you. However, note that the number of cross-platform C ++ applications supported by each database is small and inconsistent. You must estimate the platform that may be used for applications. However, it is enough in general. The above Library supports at least two types of files: windows and unix/linux. Here, we can basically move our own programs in windows and linux! ".