How to upgrade to Qt Creator 2.5.2 from Qt Creator 2.4.1

Today I decided to upgrade from Qt Creator 2.4.1 with SDK 1.2.1 (Qt 4.8.0) to Qt Creator 2.5.2. But I still want to use SDK 1.2.1, just Qt Creator 2.5.2. I did not found any normal way to upgrade from Qt Creator 2.4.1 (like Chrome or Firefox etc …). So I must do it for myself. I downloaded Qt Creator 2.5.2 from Nokia website. Then I deleted the Qt Creator 2.4.1 folder from SDK 1.2.1 (C:\QtSDK\QtCreator) and installed Qt Creator 2.5.2 into that folder. Ha ha, the shortcut to Qt Creator program is the same, the folders and files are the same and the new version run smoothly, without any bug. And the maintenance tool of Qt SDK still think that it is Qt Creator 2.4.1, it is ok for me. But there was a problem with the Boost 1.5.1 that I had updated before. That was:
main.obj:-1: error: LNK2019: unresolved external symbol “void __cdecl boost::filesystem::path_traits: ….
After a while, I found that Qt Creator used a configuration file (C:\QtSDK\Desktop\Qt\4.8.0\msvc2010\mkspecs\win32-msvc2010\qmake.conf) to build its projects. So I opened that file and changed the line:
QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t-
to:
QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t
And now it works.

Timer class for C/C++ – run on all Linux/Windows systems

File  header timer.h:

#ifndef TIMER_H
#define TIMER_H
#include <time.h>
class Timer
{
public:
Timer();
~Timer();
void start();
float Get_Elapsed_restart();
float Get_Elapsed();
float Get_Elapsed_s();
float Get_Elapsed_s_restart();
private:
clock_t starttime, finaltime;
};
#endif
File timer.cpp:

#include “timer.h”
Timer::Timer()
{
}
Timer::~Timer()
{
}

void Timer::start()
{
starttime=clock();
}

float Timer::Get_Elapsed_restart()
{
finaltime=clock();
float val=(float)(finaltime-starttime);
starttime=finaltime;
return val;
}

float Timer::Get_Elapsed()
{
finaltime=clock();
return (float)(finaltime-starttime);
}

float Timer::Get_Elapsed_s()
{
return (float)Get_Elapsed()/CLOCKS_PER_SEC;
}

float Timer::Get_Elapsed_s_restart()
{
return (float)Get_Elapsed_restart()/CLOCKS_PER_SEC;
}

Chương trình C/C++ hiển thị các file bị ẩn do virus – C/C++ program that shows hidden file by virus

// chuong trinh chuyen doi cac thu muc bi virus bien thanh an (hidden)
// sang dang binh thuong
// Ngay 10/06/2007
// Tac gia: Nguyen Huu Tuan
// De test chuong trinh, copy file .exe vao thu muc nao do
// tao thu muc an bang lenh: attrib +h +r +s <ten thu muc>
// Sau do chay thu chuong trinh
// Chuong trinh duoc dich bang C-Free, DevCpp, Visual C++ 2005

#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>

int main()
{
system(“dir /b /a > list.txt”);
ifstream fi(“list.txt”);
ofstream fo(“done.bat”);
char str[255];
fo << “@echo off” << endl;
while(fi.getline(str,255))
fo << “attrib -a -s -h -r \”” << str << “\”” << endl;
fi.close();
fo.close();
system(“done.bat”);
system(“del done.bat”);
system(“del list.txt”);
return 0;
}

GSL 1.15 and 1.16 building with Visual Studio 2010

Update 05/02/2014: A good book for GSL (updated with 1.16 version) is GNU Scientific Library Reference Manual – Third Edition.

Update 14-11-2013: Building GSL 1.16 with Visual Studio 2010 (VC++ 10): In July, GSL 1.16 was released, the source code files can be obtained from this. If one wants to build it with Visual Studio 2012 (VC++ 11), the VS solution file can be downloaded from this URL and the same steps (from 1 to 6) as doing with GSL 1.15 and VS 2010 are needed. Based on VC++ 11 solution files, I have created solution for some one who still works with Visual Studio 2010 (VC++ 10), and that file can be downloaded from this address.

Today I build GSL 1.15 for using with Visual Studio 2010. After downloading GSL 1.15 source code, I download VS 2010 solution files and start building GSL’s .dll and .lib for my own. And these are the steps:
1. Exatracting file gsl-1.15-vc10.zip into a folder (GSL_build for example). You should have the folder GSL_build\gsl-1.15-vc10 after this step.
2. Exatracting file gsl-1.15.tar.gz into folder GSL_build\gsl-1.15.
3. Copy all gsl_*.h files from GSL_build\gsl-1.15 folder to GSL_build\gsl-1.15-vc10\gsl folder (you should do a search here and make a copy on the found files).
4. Copy all files from folder GSL_build\gsl-1.15 to GSL_build\gsl-1.15-vc10 folder, do not overwrite the two file templates_on.h and env.c or you will encounter errors with Release build.
5. Open file GSL_build\gsl-1.15-vc10\build.vc10\gsl.lib.sln with VS 2010 and start Debug and Release build.
6. Open file GSL_build\gsl-1.15-vc10\build.vc10\gsl.dll.sln with VS 2010 and start Debug and Release build. You may need to copy cblas.lib file from folder build.vc10\lib\Win32 to folder build.vc10\dll\Win32 (Debug or Release sub folder) to make this step runs.
7. If you encounter errors (like me), then these are the fixings:
+ file bspline.c: moving variables declarations to the first part of the function: gsl_bspline_greville_abscissa(size_t i, gsl_bspline_workspace *w)
+ file rk4imp.c: replacing sqrt(3) with M_SQRT3.
It’s done now. You should have your .dll in gsl_build\gsl-1.15-vc10\build.vc10\dll and .lib in the folder gsl_build\gsl-1.15-vc10\build.vc10\lib.
8. Notes:
+ When copying these above files and folders, do not over write any files.
+ You can build GSL with other blas library like Goto Blas, Atlas. Just replacing the cblas.lib with the suitable .lib file in building gsl.dll.
+ For using GSL, you need both .lib file in the gsl_build\gsl-1.15-vc10\build.vc10\lib folder and .dll file in the gsl_build\gsl-1.15-vc10\build.vc10\dll folder. Do not use .lib files from gsl_build\gsl-1.15-vc10\build.vc10\dll folder.
+ You can use examples from Physics 780.20 Computational Physics course for testing your .dll and .lib files.
+ Another source you can use is located at: Data Analysis with Open source Tools. This is a good book with good examples.

+ Even though I did not test the above process of building GSL with other Visual Studio versions (VS Express, VS 2008, VS 2012) but I strongly believe that the same details can be applied.

Bài giảng C4Win – Tác giả: Trần Minh Thái

Địa chỉ download