Category Archives: C++

Use SQLite in Qt

Project file (.pro) Add the following line to your .pro file Header Source Execute a query

Continue Reading

Writing Your First Windows Application with C++

Welcome to the first windows tutorial. In this tutorial, I'll give you the basic information on how to code in windows and we'll go over a few important details first. The basic windows program has two important functions inside. The first one is the event handler(I'll talk about this one later on) and the second one is the main function(WinMain from now on). WinMain is similar to DOS' main function, in fact, WinMain is called from the DOS main function but in windows, we don't have access to the DOS main; everything is covered up by windows. Windows introduces us to messages. A message could be easily described as a pile of data that gets sent to the event handler…

Continue Reading

Friends of Template Classes

A problem that I have been struggling with for some days. When I declare a template function as a friend of a template class, I'll get a compile error, such as the following: And I'll get a compile error message: undefined reference to 'operator< <(std::ostream&, test const&)' Finally, I found that we couldn't declare a friend function like that, we need to specify a different template type for it.

Continue Reading
Contact Us
  • Nanyang Technological University, Singapore
  • root [at] haozhexie [dot] com