Differences
This shows you the differences between two versions of the page.
— | devwiki:cpp [2023/01/07 16:11] (current) – created ying | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | |||
+ | ====== My simple note on C++ ====== | ||
+ | |||
+ | May 30 - 2009 7:44 PM \\ | ||
+ | I want: | ||
+ | * simple text editor (done in 2016.06 with my universal_tool_template.py) | ||
+ | * cmd to compile my code without GUI (done in 2017.01 with Qt lib and C++ compiler) | ||
+ | * run the cmd tool on my mac,win and linux (done in 2016.06 with my universal_tool_template.py) | ||
+ | |||
+ | the solution I found | ||
+ | - write a standard c++ main code (on mac) | ||
+ | - "g++ main.cpp -o main" using gcc (bundled with Xcode) | ||
+ | - I got my " | ||
+ | - works | ||
+ | - then cross-compile on mac, get win and linux binary | ||
+ | |||
+ | ====== C++ as cross-compile language ====== | ||
+ | |||
+ | ===== standard c++ vs visual c++ ===== | ||
+ | * because standard c++ library is small, you need to write a lot of basic functions | ||
+ | * 3rd party framework and library are often used to speed up development process | ||
+ | * VC++ is standard c++ with MFC library (win only) and .NET framework | ||
+ | * .Net's CLR library also extend c++; (CLI), but it works better with C#, VB.NET and other .NET languages | ||
+ | * The Common Language Runtime (CLR) is a core component of Microsoft' | ||
+ | |||
+ | ===== C++ for written-once-multi-compile solution | ||
+ | * gcc is " | ||
+ | * Microsoft Visual Studio Visual C++ compiler can compile standard c++ code, and surely can compile the c++ code using MFC and .Net functions, which other compilers can not use. | ||
+ | * Learning VC++ is actually learning how to use MS Visual Studio IDE and MFC; and you are selling yourself to Microsoft and losing the freedom of going for other Operating Systems other than Windows. | ||
+ | * However, MS Visual Studio including VC++ is " | ||
+ | * Mono project is a project porting .Net framework to other platforms, and it is free. | ||
+ | |||
+ | ===== reference ===== | ||
+ | |||
+ | C++ vs VC++ http:// | ||
+ | |||
+ | Classic c++ vs VS c++ http:// | ||
+ | |||
+ | ====== C++ syntax quick guide ====== | ||
+ | |||
+ | * string and char array operation | ||
+ | * compare of c++ and c for string operation <code cpp> | ||
+ | for C++ strings: | ||
+ | |||
+ | string input, other = " | ||
+ | cin >> input; | ||
+ | result = input+other; | ||
+ | |||
+ | for C strings: | ||
+ | |||
+ | char *input= new char[/*here the maximum length for the input string*/], *other=" | ||
+ | cin >> input; | ||
+ | result = new char[strlen(input)+strlen(other)]; | ||
+ | sprintf(result," | ||
+ | </ | ||
+ | |||
+ | |||
+ | ====== Tutorials ====== | ||
+ | |||
+ | * video: http:// | ||