Code::Blocks Forums

User forums => Help => Topic started by: robal on June 10, 2005, 11:02:43 pm

Title: wxWindows-2.4.2 problem....
Post by: robal on June 10, 2005, 11:02:43 pm
Hi
I try to compile wxWidgets-2.4.2 version to static linke library (both debug and release). I have downloaded VC2003 toolkit and set it as default compiler. I imported dsw workspace into code::blocks and during compilation i have message:

msw\version.rc    12    fatal error RC1015: cannot open include file "wx/version.h",

 what is very strage, because such file existing in appropriate path. Maybe have you some ideas about that?
Title: wxWindows-2.4.2 problem....
Post by: rickg22 on June 11, 2005, 12:02:45 am
Hmmmmmmmm

I never built wxwidgets using code::blocks. Instead i use the makefiles.

But the dsw workspace should have been imported correctly...
Title: wxWindows-2.4.2 problem....
Post by: mandrav on June 11, 2005, 09:35:03 am
Check the resource compiler's dirs...

Yiannis.
Title: wxWindows-2.4.2 problem....
Post by: Matroc on June 11, 2005, 12:20:14 pm
Well i just tried to import the wxWidgets 2.6.1 dsw to try if it works this way but even on importing there is a lot of errors saying hat heres not enough memory for creating a thread (on an  1gb ram machine).

and the created projects have default compiler/linker settings for all targets

even in the wx_dll.dsw, all projects are seup to create only statically linked librarys.

i dont think c::b is the way to compile wx...


but the makefile too makes some trouble (that can be fixed though)

ill post just a brief howto compile here, maybe someone can make use of it:

1. get the following things
msvctoolkit 2k3 (http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&displaylang=en)[/list:u]MS Platform SDK (http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm) this one is for all windows versions up to server 2k3 (i havnt tried to compile using this one instead of an old one but it should make no problems)[/list:u]the NMAKE tool (http://support.microsoft.com/default.aspx?scid=kb;en-us;Q132084)[/list:u]
Code
@echo off
SET LIB_ARGUMENTS=/LIB
:LIB_ARG_LOOP
IF $%1$ == $$ GOTO LIB_RUN
SET LIB_ARGUMENTS=%LIB_ARGUMENTS% %1
SHIFT
GOTO LIB_ARG_LOOP
:LIB_RUN
link %LIB_ARGUMENTS%

the downside of this method is that some librarys (not wxwidgets) wont compile with this, because they're searching for an lib.EXE.
but theres another solution o this problem: make your own lib.exe ;-)
create a new simple c++ project, paste the following code and compile
Code
/*
 * lib.c
 *
 * simulate missing lib.exe by calling link.exe /lib
 */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

static int
findInPath (
    char * fullpath,
    const char * executable)
{
    const char * pathvar = getenv ("PATH");
    const char * dirstart = pathvar;
    const char * dirend;
    int          dirlen;
    FILE       * dummy;

    if (pathvar == NULL) {
        return 0;
    }
    while (dirstart [0] != '\0') {
        dirend = strchr (dirstart, ';');
        if (dirend == NULL) {
            dirlen = strlen (dirstart);
        }
        else {
            dirlen = dirend - dirstart;
        }
        sprintf (fullpath, "%.*s\\%s", dirlen, dirstart, executable);
        dummy = fopen (fullpath, "rb");
        if (dummy != NULL) {
            fclose (dummy);
            return 1;
        }
        if (dirend == NULL) {
            return 0;
        }
        dirstart = dirend + 1;
    }
    return 0;
}

int main (
    int argc,
    const char ** argv)
{
    char fullpath [255];
    char ** newargs;
    if (!findInPath (fullpath, "link.exe")) {
        fprintf (stderr, "lib.exe: link.exe not found in %PATH%\n");
        exit (2);
    }
    newargs = calloc (argc + 2, sizeof (char*));
    if (newargs == NULL) {
        fprintf (stderr, "lib.exe: allocation of arguments failed\n");
        exit (2);
    }
    memcpy (newargs + 2, argv + 1, (argc - 1) * sizeof (char *));
    newargs [0] = "link.exe";
    newargs [1] = "/lib";
    execv (fullpath, newargs);
}
note: this and the lib.bat are NOT my creations, i pulled them from another side but cant remember the url :-/


this should be everything thats needed to build wxWidgets.
now edit yout setup.h (located in %WXWIN%\include\wx\msw, and dont forget to copy it to %WXWIN%\include\wx) and your config.vc (located in %WXWIN%\build\msw) to suit your needs ande compile by typing "nmake -f makefile.vc" on the console in the %WXWIN%\build\msw directory.

now lean back and watch your wx libs to compile :-)
Title: wxWindows-2.4.2 problem....
Post by: rickg22 on June 12, 2005, 01:29:41 am
Quote from: Matroc
Well i just tried to import the wxWidgets 2.6.1 dsw to try if it works this way but even on importing there is a lot of errors saying hat heres not enough memory for creating a thread (on an  1gb ram machine).


 :shock: Oh no! The "cannot create thread (error 8 ) " (http://sourceforge.net/tracker/index.php?func=detail&aid=1166356&group_id=126998&atid=707416) strikes again!!

Can you REPRODUCE that error? We've been trying to replicate it without success for MONTHS. And I have the hunch that it only happens when imported workspaces can't find a particular file (creating a thread for a nonexistent file, maybe?).
Title: wxWindows-2.4.2 problem....
Post by: Matroc on June 12, 2005, 10:46:00 am
well, yeah i can reproduce them, importing the wx.dsw causes hundrets of them for me...

//edit
i just noticed: importing the wx_dll.sln file is even worse, it seems to try to read a null pointer somewhere, crashing c::b immediately (can be reproduced too ;-)
Title: wxWindows-2.4.2 problem....
Post by: David Perfors on June 12, 2005, 02:54:23 pm
I can't reproduce it... or should I try to compile first? I tried the wx.dsw. (with C::B 1.0finalbeta, Mingw, Windows XP.) I can't try that sln file, because I don't have it.
Title: wxWindows-2.4.2 problem....
Post by: Anonymous on June 13, 2005, 10:11:44 am
Resolution was simple, as mandrav said it was enough to set compilers resource directories and wxWidgets is building. But when i try to link it with my own program i get few hundreds linker errors about unresolved external symbols (for example Mutex::Unlock(void)).
Title: wxWindows-2.4.2 problem....
Post by: rickg22 on June 13, 2005, 06:12:12 pm
Matroc: Null pointers are EASY to diagnose! :D Run codeblocks in "debug mode" and wait for the segfault. Then do a backtrace and paste the results in a new bug report.