devwiki:cpp

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 "main" binary file, and I "open main" in console (mac),
 +  - 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's .NET initiative
 +
 +===== C++ for written-once-multi-compile solution  =====
 +  * gcc is "the" best compiler for standard c++ code.
 +  * 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 "the" best GUI application development IDE available, and fits Windows best.
 +  * Mono project is a project porting .Net framework to other platforms, and it is free.
 +
 +===== reference =====
 +
 +C++ vs VC++ http://www.sharkyforums.com/archive/index.php/t-91725.html
 +
 +Classic c++ vs VS c++ http://www.daniweb.com/forums/thread155363.html
 +
 +====== 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 = "\\Someplace\\Data\\file.dat", result;
 +cin >> input;
 +result = input+other;
 +
 +for C strings:
 +
 +char *input= new char[/*here the maximum length for the input string*/], *other="\\Someplace\\Data\\file.dat", *result;
 +cin >> input;
 +result = new char[strlen(input)+strlen(other)];
 +sprintf(result,"%s%s",input,other);
 +</code>
 +
 +
 +====== Tutorials ======
 +
 +  * video: http://www.youtube.com/user/VoidRealms/playlists