Author Topic: Code::Blocks can not locate QTCore folder on MAC OS LION  (Read 6329 times)

numismatyc

  • Guest
Code::Blocks can not locate QTCore folder on MAC OS LION
« on: October 28, 2011, 02:01:37 pm »
I'm a little bit confused of why C::B cannt find this folder. Qt is installed into /usr/local/Trolltech/Qt-4.7.4 , when i try to create a qt project using C::B in a window i must to locate top level folder where qt4 was installed (must contain include and lib subfolders) ,yes, i checked and these subfolders are in the right place. Anyway when i select this path /usr/local/Trolltech/Qt-4.7.4 , i'm getting an error

http://imageshack.us/photo/my-images/851/screenshot20111028at224.jpg/

QTCore folder is a subfolder of include

Offline Freem

  • Almost regular
  • **
  • Posts: 219
Re: Code::Blocks can not locate QTCore folder on MAC OS LION
« Reply #1 on: October 28, 2011, 03:54:56 pm »
Did you try to give the sub-entry lib?
I'm not sure it will solve, but I have to do the same when I use (other) libraries (and can't use relative path).

numismatyc

  • Guest
Re: Code::Blocks can not locate QTCore folder on MAC OS LION
« Reply #2 on: October 28, 2011, 05:12:50 pm »
If i give sub-entry lib then error message is saying that C::B can not locate include directory

edited :

I also tried to copy QTCore folder in same  root-folder (  /usr/local/Trolltech/Qt-4.7.4/ ), where are placed lib and include
« Last Edit: October 28, 2011, 05:34:02 pm by numismatyc »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Code::Blocks can not locate QTCore folder on MAC OS LION
« Reply #3 on: October 28, 2011, 05:28:36 pm »
If i give sub-entry lib then error message is saying that C::B can not locate include directory
You have to adjust the wizard (right click on it and select edit).

Look: I seems QT changes it's directory layout with nearly every release. I'm sick of adopting the wizard over and over again. Not to forget that if adopted, it'll no longer work with older releases.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

numismatyc

  • Guest
Re: Code::Blocks can not locate QTCore folder on MAC OS LION
« Reply #4 on: October 28, 2011, 05:57:38 pm »
Quote
You have to adjust the wizard (right click on it and select edit).

Could you be more explicit ? I must to edit wizard script ?  

Code
// Qt4 project wizard
//
////////////////////////////////////////////////////////////////////////////////

// globals
QtPathDefault    <- _T("$(#qt4)");
QtPathDefaultInc <- _T("$(#qt4.include)");
QtPathDefaultLib <- _T("$(#qt4.lib)");
QtPath <- _T("");

function BeginWizard()
{
    local intro_msg = _T("Welcome to the new Trolltech Qt4 project wizard!\n" +
                         "This wizard will guide you to create a new Qt4 project\n" +
                         "using the Trolltech Qt4 cross-platform GUI toolkit\n\n" +
                         "When you're ready to proceed, please click \"Next\"...");

    local qtpath_msg = _T("Please select the location of Trolltech Qt4 on your computer.\n" +
                          "This is the top-level folder where Qt4 was installed.\n" +
                          "To help you, this folder must contain the subfolders\n" +
                          "\"include\" and \"lib\".");

    Wizard.AddInfoPage(_T("QtIntro"), intro_msg);
    Wizard.AddProjectPathPage();
    Wizard.AddGenericSelectPathPage(_T("QtPath"), qtpath_msg, _T("Qt's location:"), QtPathDefault);
    Wizard.AddCompilerPage(_T(""), _T("gcc*"), true, true);
}

////////////////////////////////////////////////////////////////////////////////
// Qt's path page
////////////////////////////////////////////////////////////////////////////////

function OnLeave_QtPath(fwd)
{
    if (fwd)
    {
        local dir         = Wizard.GetTextControlValue(_T("txtFolder")); // txtFolder is the text control in GenericSelectPathPage
        local dir_nomacro = VerifyDirectory(dir);

        if (dir_nomacro.IsEmpty())
            return false;

        // verify include dependencies
        local dir_nomacro_inc = GetCompilerIncludeDir(dir, QtPathDefault, QtPathDefaultInc);
        if (dir_nomacro_inc.IsEmpty())
            return false;
        if (PLATFORM == PLATFORM_MSW
            && !VerifyFile(dir_nomacro_inc + wxFILE_SEP_PATH + _T("QtGui"), _T("QApplication"), _T("Qt's include")))
            return false;

        // verify library dependencies
        local dir_nomacro_lib = GetCompilerLibDir(dir, QtPathDefault, QtPathDefaultLib);
        if (dir_nomacro_lib.IsEmpty())
            return false;
        if (PLATFORM == PLATFORM_MSW && !VerifyLibFile(dir_nomacro_lib, _T("QtCore4"), _T("Qt's")))
            return false;
        else if (PLATFORM != PLATFORM_MSW && !VerifyLibFile(dir_nomacro_lib, _T("QtCore"), _T("Qt's")))
            return false;


        QtPath = dir; // Remember the original selection.

        local is_macro = _T("");

        // try to resolve the include directory as macro
        is_macro = GetCompilerIncludeMacro(dir, QtPathDefault, QtPathDefaultInc);
        if (is_macro.IsEmpty())
        {
            // not possible -> use the real inc path we had computed instead
            QtPathDefaultInc = dir_nomacro_inc;
        }

        // try to resolve the library directory as macro
        is_macro = GetCompilerLibMacro(dir, QtPathDefault, QtPathDefaultLib);
        if (is_macro.IsEmpty())
        {
            // not possible -> use the real lib path we had computed instead
            QtPathDefaultLib = dir_nomacro_lib;
        }
    }
    return true;
}

// return the files this project contains
function GetFilesDir()
{
    return _T("qt4/files");
}

// setup the already created project
function SetupProject(project)
{
    project.AddIncludeDir(QtPathDefaultInc);
    project.AddIncludeDir(QtPathDefaultInc + wxFILE_SEP_PATH + _T("QtGui"));

    project.AddLibDir(QtPathDefaultLib);

    // add link libraries
    if (PLATFORM == PLATFORM_MSW)
    {
        project.AddLinkLib(_T("QtCore4"));
        project.AddLinkLib(_T("QtGui4"));
    }
    else
    {
        project.AddLinkLib(_T("QtCore"));
        project.AddLinkLib(_T("QtGui"));
    }

    // enable compiler warnings (project-wide)
    WarningsOn(project, Wizard.GetCompilerID());

    // Debug
    local target = project.GetBuildTarget(Wizard.GetDebugName());
    if (!IsNull(target))
    {
        target.SetTargetType(ttConsoleOnly); // ttConsoleOnly: console for debugging
        target.SetOutputFilename(Wizard.GetDebugOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE);
        // enable generation of debugging symbols for target
        DebugSymbolsOn(target, Wizard.GetCompilerID());
    }

    // Release
    target = project.GetBuildTarget(Wizard.GetReleaseName());
    if (!IsNull(target))
    {
        target.SetTargetType(ttExecutable); // ttExecutable: no console
        target.SetOutputFilename(Wizard.GetReleaseOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE);
        // enable optimizations for target
        OptimizationsOn(target, Wizard.GetCompilerID());
    }

    return true;
}

« Last Edit: October 28, 2011, 06:25:53 pm by numismatyc »

Offline vithor

  • Single posting newcomer
  • *
  • Posts: 1
Re: Code::Blocks can not locate QTCore folder on MAC OS LION
« Reply #5 on: April 17, 2024, 05:24:36 pm »
Quote
You have to adjust the wizard (right click on it and select edit).

Could you be more explicit ? I must to edit wizard script ? 

Code
// Qt4 project wizard
//
////////////////////////////////////////////////////////////////////////////////

// globals
QtPathDefault    <- _T("$(#qt4)");
QtPathDefaultInc <- _T("$(#qt4.include)");
QtPathDefaultLib <- _T("$(#qt4.lib)");
QtPath <- _T("");

function BeginWizard()
{
    local intro_msg = _T("Welcome to the new Trolltech Qt4 project wizard!\n" +
                         "This wizard will guide you to create a new Qt4 project\n" +
                         "using the Trolltech Qt4 cross-platform GUI toolkit\n\n" +
                         "When you're ready to proceed, please click \"Next\"...");

    local qtpath_msg = _T("Please select the location of Trolltech Qt4 on your computer.\n" +
                          "This is the top-level folder where Qt4 was installed.\n" +
                          "To help you, this folder must contain the subfolders\n" +
                          "\"include\" and \"lib\".");

    Wizard.AddInfoPage(_T("QtIntro"), intro_msg);
    Wizard.AddProjectPathPage();
    Wizard.AddGenericSelectPathPage(_T("QtPath"), qtpath_msg, _T("Qt's location:"), QtPathDefault);
    Wizard.AddCompilerPage(_T(""), _T("gcc*"), true, true);
}

////////////////////////////////////////////////////////////////////////////////
// Qt's path page
////////////////////////////////////////////////////////////////////////////////

function OnLeave_QtPath(fwd)
{
    if (fwd)
    {
        local dir         = Wizard.GetTextControlValue(_T("txtFolder")); // txtFolder is the text control in GenericSelectPathPage
        local dir_nomacro = VerifyDirectory(dir);

        if (dir_nomacro.IsEmpty())
            return false;

        // verify include dependencies
        local dir_nomacro_inc = GetCompilerIncludeDir(dir, QtPathDefault, QtPathDefaultInc);
        if (dir_nomacro_inc.IsEmpty())
            return false;
        if (PLATFORM == PLATFORM_MSW
            && !VerifyFile(dir_nomacro_inc + wxFILE_SEP_PATH + _T("QtGui"), _T("QApplication"), _T("Qt's include")))
            return false;

        // verify library dependencies
        local dir_nomacro_lib = GetCompilerLibDir(dir, QtPathDefault, QtPathDefaultLib);
        if (dir_nomacro_lib.IsEmpty())
            return false;
        if (PLATFORM == PLATFORM_MSW && !VerifyLibFile(dir_nomacro_lib, _T("QtCore4"), _T("Qt's")))
            return false;
        else if (PLATFORM != PLATFORM_MSW && !VerifyLibFile(dir_nomacro_lib, _T("QtCore"), _T("Qt's")))
            return false;


        QtPath = dir; // Remember the original selection.

        local is_macro = _T("");

        // try to resolve the include directory as macro
        is_macro = GetCompilerIncludeMacro(dir, QtPathDefault, QtPathDefaultInc);
        if (is_macro.IsEmpty())
        {
            // not possible -> use the real inc path we had computed instead
            QtPathDefaultInc = dir_nomacro_inc;
        }

        // try to resolve the library directory as macro
        is_macro = GetCompilerLibMacro(dir, QtPathDefault, QtPathDefaultLib);
        if (is_macro.IsEmpty())
        {
            // not possible -> use the real lib path we had computed instead
            QtPathDefaultLib = dir_nomacro_lib;
        }
    }
    return true;
}

// return the files this project contains
function GetFilesDir()
{
    return _T("qt4/files");
}

// setup the already created project
function SetupProject(project)
{
    project.AddIncludeDir(QtPathDefaultInc);
    project.AddIncludeDir(QtPathDefaultInc + wxFILE_SEP_PATH + _T("QtGui"));

    project.AddLibDir(QtPathDefaultLib);

    // add link libraries
    if (PLATFORM == PLATFORM_MSW)
    {
        project.AddLinkLib(_T("QtCore4"));
        project.AddLinkLib(_T("QtGui4"));
    }
    else
    {
        project.AddLinkLib(_T("QtCore"));
        project.AddLinkLib(_T("QtGui"));
    }

    // enable compiler warnings (project-wide)
    WarningsOn(project, Wizard.GetCompilerID());

    // Debug
    local target = project.GetBuildTarget(Wizard.GetDebugName());
    if (!IsNull(target))
    {
        target.SetTargetType(ttConsoleOnly); // ttConsoleOnly: console for debugging
        target.SetOutputFilename(Wizard.GetDebugOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE);
        // enable generation of debugging symbols for target
        DebugSymbolsOn(target, Wizard.GetCompilerID());
    }

    // Release
    target = project.GetBuildTarget(Wizard.GetReleaseName());
    if (!IsNull(target))
    {
        target.SetTargetType(ttExecutable); // ttExecutable: no console
        target.SetOutputFilename(Wizard.GetReleaseOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE);
        // enable optimizations for target
        OptimizationsOn(target, Wizard.GetCompilerID());
    }

    return true;
}



you can define the base folder normally, then in the wizard, edit the part where it recognize qtcore , see in the lib folder and locate the name of the .a file and make the changes, that worked for me