Very important after installing MSYS

Using MSYS with MinGW

It is convenient to have your MinGW installation mounted on /mingw, since /mingw is on MSYS PATH by default. For this to work, just type (assuming MinGW is on c:\mingw):

mount c:/mingw /mingw

mingw-get install autotools

To install 3rd party library and applications which uses the autotools build system the following commands are often used.

./configure –prefix=/mingw
make install

Build OpenSSL using MSYS

Download latest OpenSSL from (e.g. openssl-1.0.1c.tar.gz)
Start a MSYS command prompt (C:\msys\1.0\msys.bat)
Extract tar.gz using MSYS tar (and ignore the symlink warnings)
don’t use 7zip or other apps, since they fail to set up any symlinks! tar will also complain about symlinks, but compilation will still succeed.

$ tar xvzf openssl-1.0.1c.tar.gz
$ cd openssl-1.0.1c

Check that gcc is in PATH, otherwise add it, e.g.

$ export PATH=/c/Mingw-builds/bin:$PATH

for MinGW (32 bit) do:

$ ./Configure –prefix=$PWD/dist no-idea no-mdc2 no-rc5 shared mingw

for MinGW-w64 do:

$ ./Configure –prefix=$PWD/dist no-idea no-mdc2 no-rc5 shared mingw64

Compile & install:

$ make depend && make && make install

What is __gxx_personality_v0 and its solutions

It is used in the stack unwiding tables, which you can see for instance in the assembly output of my answer to another question. As mentioned on that answer, its use is defined by the Itanium C++ ABI, where it is called the Personality Routine.

The reason it “works” by defining it as a global NULL void pointer is probably because nothing is throwing an exception. When something tries to throw an exception, then you will see it misbehave.

Solution 1

Of course, if nothing is using exceptions, you can disable them with -fno-exceptions (and if nothing is using RTTI, you can also add -fno-rtti). If you are using them, you have to (as other answers already noted) link with g++ instead of gcc, which will add -lstdc++ for you.

Solution 2
But in my case it comes because of wrong version of mingw32-make is used. It was compiling correctly but failed linking exe.
Finally I have to remove all other version except Qt inbuilt one.

Qt Flags Info

$(ENV_VAR) : Point local variable

$$(ENV_VAR) : Access global environment variable and more like qmake way


This makes qmake respect those environment variables. Note that qmake uses LFLAGS instead of LDFLAGS.


For all type of builds

If you would like to apply flags to just the release build, then you can use this:

You also probably want to change your condition to be a little more flexible. In summary, something like this:
*-g++* {

Privacy Policy Sample

COMPANY NAME collects information from you when you register on our site, place an order, subscribe to our newsletter or fill out a form. When ordering or registering on our site, as appropriate, you may be asked to enter your name, e-mail address, mailing address, phone number. You may, however, visit our site anonymously.

Any of the information we collect from you may be used in one of the following ways:
To personalize your experience (your information helps us to better respond to your individual needs)
To improve our website (we continually strive to improve our website offerings based on the information and feedback we receive from you)
To improve customer service (your information helps us to more effectively respond to your customer service requests and support needs)
To process transactions your information, whether public or private, will not be sold, exchanged, transferred, or given to any other company for any reason whatsoever, without your consent, other than for the express purpose of delivering the purchased product or service requested.
To administer a contest, promotion, survey or other site feature
To send periodic emails the email address you provide for order processing, will only be used to send you information and updates pertaining to your order.

COMPANY NAME implements a variety of security measures to maintain the safety of your personal information when you place an order or enter, submit, or access your personal information. We have implemented Internet Gateway Security & CRM Solution at our office.

We offer the use of a secure server. All supplied sensitive/credit information is transmitted via Secure Socket Layer (SSL) technology and then encrypted into our Payment gateway providers database only to be accessible by those authorized with special access rights to such systems, and are required to keep the information confidential.

Yes (Cookies are small files that a site or its service provider transfers to your computer hard drive through your Web browser (if you allow) that enables the sites or service providers systems to recognize your browser and capture and remember certain information We use cookies to help us remember and process the items in your shopping cart and understand and save your preferences for future visits.

COMPANY NAME does not sell, trade, or otherwise transfer to outside parties your personally identifiable information. This does not include trusted third parties who assist us in operating our website, conducting our business, or servicing you, so long as those parties agree to keep this information confidential. We may also release your information when we believe release is appropriate to comply with the law, enforce our site policies, or protect ours or others rights, property, or safety. Any unauthorized access to COMPANY NAME server is strictly prohibited. However, non-personally identifiable visitor information may be provided to other parties for marketing, advertising, or other uses.

This online privacy policy applies only to information collected through our website.

By using our site, you consent to our website privacy policy and all terms and conditions.

If we decide to change our privacy policy, we will post those changes on this page.

If there are any questions regarding this privacy policy you may contact us using the information our Website Address or Email address

Disclaimer: COMPANY NAME is a THIRD-PARTY SERVICE provider for software related issues in desktops, laptops, and peripherals. We provide services through our pool of rained specialists and experts. The brand names, trademarks, logos, company names used in the site and belong to their respective owners. Brand names, trademarks, logos, company names used in the site are for representation purposes only.

SQLITE MINGW and MSYS installation on windows

Install SQLite3 from source codes on MinGW and MSYS

At SQLite3 download page,choose sqlite-amalgamation-3.7.3.tar.gz, neither nor

For MinGW and MSYS, sqlite-amalgamation-X.X.X.tar.gz is best and only source tarball.

Instrunctions on MinGW and MSYS are below:

> tar -zxvf sqlite-amalgamation-3.7.3.tar.gz
> cd sqlite-3.7.3
> ./configure –prefix=c:/sqlite3
> make
> make install

Either please paste libsqlite3-0.dll. inside /mingw/bin or

set “c:/sqlite3/bin” to PATH for loading libsqlite3-0.dll.

You are done

MSYS , MinGW : /home/keith/staged/mingw32 problems

It may produce many errors like

>> /bin/grep: /home/keith/staged/mingw32/lib/ No such file or
>> directory
>> /bin/sed: can’t read /home/keith/staged/mingw32/lib/ No
>> such file or directory
>> libtool: link: `/home/keith/staged/mingw32/lib/’ is not a
>> valid libtool archive

and so on.

Problem is MSYS contains hardlink links which are invalid. so search from root of MinGW .
You can achieve by searching /home/keith/staged/mingw32/ and wherever you found simple remove links.

That’s it.

It’s a bug in MSYS. We need to report this. I haven’t.

OPENSSL fatal error : OPENSSL_Uplink(014CF020,06): no OPENSSL_Applink

OPENSSL_Uplink(014CF020,06): no OPENSSL_Applink


You have to have the two files Libeay32.dll and Ssleay32.dll which is used to compile code. Using different version create this problem.

pkg-config in Qt : Makes it rock solid and easy

Using pkg-config in qmake

CONFIG += link_pkgconfig # this is important
PKGCONFIG += libname

CONFIG += warn_on link_pkgconfig
PKGCONFIG += libsearpc libccnet libseafile glib-2.0 sqlite3 jansson openssl


CONFIG += link_pkgconfig

packagesExist(glib-2.0) {
PKGCONFIG += glib-2.0

// and in the code:
#ifdef HAS_GLIB
// use glib here

find normally if failed find using by disabling windows system redirection

//try to find normally if failed find using by disabling windows system redirection redirection

BOOL Helper::isFileExists(QString path , bool is32Redirection)
    PVOID OldValue = NULL;

        return true;

    //  Disable redirection immediately prior to the native API
    //  function call.

   BOOL result = 1;
        result = Wow64DisableWow64FsRedirection(&OldValue);

    if( result )

        //path = path.toLower().replace("system32","Sysnative");

        LPCTSTR szPath = (LPCTSTR) path.utf16();

        //    //This will get the file attributes bitlist of the file
        //        DWORD fileAtt = GetFileAttributesA(szPath);

        //        //If an error occurred it will equal to INVALID_FILE_ATTRIBUTES
        //        if(fileAtt == INVALID_FILE_ATTRIBUTES)
        //            //So lets throw an exception when an error has occurred
        //            return 0;

        //        //If the path referers to a directory it should also not exists.
        //        return ( ( fileAtt & FILE_ATTRIBUTE_DIRECTORY ) == 0 );

        WIN32_FILE_ATTRIBUTE_DATA  fad = {0};

        DWORD dwAttrib= GetFileAttributesEx(szPath,GetFileExInfoStandard, &fad);

//        qDebug() << (BOOL)dwAttrib ;

        //cleanup redirection
        if(is32Redirection) {
            if ( FALSE == Wow64RevertWow64FsRedirection(OldValue) )
                //  Failure to re-enable redirection should be considered
                //  a criticial failure and execution aborted.
                qDebug() << "Cleanup redirection failed";
                return 0;

        result = (BOOL)dwAttrib;

            return result;

        return is32Redirection == false ? isFileExists(path,true) : 0 ;

    return 0;

    //  return (dwAttrib != INVALID_FILE_ATTRIBUTES &&
    //         !(dwAttrib & FILE_ATTRIBUTE_DIRECTORY));

How to open a 64bit command prompt from a 32bit application

Don’t create cmd64 link or or use mklink

There is cleaner solution.

We can execute 32 bit / 64 bit commands from 32/64 apps/commands with following pattern.
SysWOW64 == 32 bit commands/apps
SysNative == 64 bit commands/apps


Run 32 bit Reg

Run 64 bit reg

if you use system32 it will redirect to 32 bit reg when used from 32 bit app so avoid using it. Use sysnative. or disable redirection for temporary

SysNative is valid vista above only

This is complete solution (Qt)

QString reg32 = qgetenv("windir")+"\\SysWOW64\\reg.exe";
QString reg64 = qgetenv("windir")+ "\\sysnative\\reg.exe";

QString command = tr("%1 DELETE \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\SharedDLLs\" /v \"%2\" /f")
        .arg(  is32Bit == true ? reg32 : reg64  )

QProcess *process = new QProcess(this);

if (process->waitForStarted())
    QString l = process->readAllStandardOutput().simplified();

    Logger::Log_Info("RegistryCleaner", command);

        Logger::Log_Error("RegistryCleaner", "Try again." );
        Logger::Log_Info("RegistryCleaner", "Successfully done" );
    qDebug() << process->readAllStandardError().simplified();

delete process;

Remove all files from directory/folder in Qt

Clean directory entries/ Empty directory/folder content

//single line function 
QDir dir( path );

//But there is no info about deleting files and whether they are deleted or not. and also it remove directory itself
// so you need to create a empty directory again in case you want to delete content only.

//Below functions does same except it won't remove directory and gives proper status of each files.

//Yash - : Please don't remove this line
bool Cleanup::clearDir( const QString path )
    QDir dir( path );

    dir.setFilter( QDir::NoDotAndDotDot | QDir::Files );
    foreach( QString dirItem, dir.entryList() )
        if( dir.remove( dirItem ) )
            Logger::Log_Info( "Cleanup", "Deleted - " + path + QDir::separator() + dirItem );
            Logger::Log_Error( "Cleanup", "Fail to delete - " + path+ QDir::separator() + dirItem);

    dir.setFilter( QDir::NoDotAndDotDot | QDir::Dirs );
    foreach( QString dirItem, dir.entryList() )
        QDir subDir( dir.absoluteFilePath( dirItem ) );
        if( subDir.removeRecursively() )
            Logger::Log_Info("Cleanup","Deleted - All files under " + dirItem );
            Logger::Log_Error("Cleanup","Fail to delete - Files under " + dirItem);

    return true;

converting QString to LPCWSTR, QString to const wchar_t, QString to CONST WCHAR and vice-versa

All of above means same. Below I’ve explained why

Convert from QString to LPCWSTR

QString key;
const wchar_t *keyName = (const wchar_t*)key.utf16();

LPCWSTR = const wchar_t

Here is how
CONST = const
wchar_t = WCHAR

//so we can write like this
LPCWSTR str = (const wchar_t*)key.utf16();

Convert from LPCWSTR to QString


Laravel load Huge CSV file into MySQL

$csv = app_path().DIRECTORY_SEPARATOR."database".DIRECTORY_SEPARATOR."resources".DIRECTORY_SEPARATOR."locations.csv";
 $query = sprintf("LOAD DATA INFILE '%s' INTO TABLE locations FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' ESCAPED BY '\"' LINES TERMINATED BY '\\n' IGNORE 0 LINES (`location_id`, `country`, `region`, `city`, `postal_code`, `lat`, `lng`, `metro_code`, `area_code`)", addslashes($csv));

May face this problem

SQLSTATE[28000]: Invalid authorization specification: 1045 Access denied for user ‘ww’@’localhost’ (using password: YES)

So the first thing I did was to check if the parameter “local_infile” was enabled in my mysql database by running the following command:

mysql> show variables;

As in my case was already, I added the following parameter in my config file laravel / database.php:

'options'  => array(

And then added the argument ‘local’ for the load data infile command, thus:

$pdo = DB::connection()->pdo;
$pdo->exec("load data LOCAL infile '".path('data')."filetoimport.sql' replace into table tablename CHARACTER SET 'UTF8' FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\\n';");

Instead of:

$pdo = DB::connection()->pdo;
$pdo->exec("load data infile '".path('data')."filetoimport.sql' replace into table tablename CHARACTER SET 'UTF8' FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\\n';");

This is one solution

and other is

Try to give more privileges ..admin and query related. In my case giving more access worked.


Extract environmental variable and replace using Qt

QString Common::parse(QString str)
    int pos = 0;
    QRegExp rx("%([^%]+)%"); // Match env var between two '%'
    while((pos = rx.indexIn(str, pos)) != -1)
        // Replace env var
        QString capture = rx.cap(1);
        QString replacement = qgetenv(capture.toLatin1().constData());
        str.replace("%" + capture + "%", replacement);

        // Skip env var + two '%'
        pos += rx.matchedLength() + 2;
    return str;

Manually Clean Windows’s Registry

Windows Registry is a virtual record of physically scattered hives, containing certain system and user settings. These records are employed by system components, third party applications, hardware, user profiles, and other great deal of stuff. A contaminated registry can lead to certain problematic situations, like sluggish PC performance, broken file extensions, and misconfigured applications.


Fortunately, Windows lets you enter the realm of its registry and make changes in it. You can create, remove, copy, rename, and modify registry entries for your own customization. However, to perform such tasks, you must possess an advanced level of knowledge and experience.


Assess registry entries to know their validity. Some of the basic types of entries are;


  • Application Settings
  • Uninstall Entries
  • Shared DLLs
  • Startup Items
  • File Extension Association
  • COM Components
  • Drivers and Services


Detailed examples associating each of the above are described below. Each cleaning process requires Registry Editor. Wait a second! Just before editing your registry, make sure to create a backup to avoid inconvenience due to any mistake.


  • Type regedit in the Run box or Start menu/screen Search
  • Click Yes on UAC message to confirm your action
  • Create a backup of your current registry by accessing File menu and selecting Export
  • Under Export range select All, give .reg file a name and Save it
  • If anything goes wrong during the course of registry cleanup, you can restore the backup by accessing Import option from File menu
  • In the displayed Dialog box locate the .reg file created earlier and click Open.

Continue reading Manually Clean Windows’s Registry