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?
Hmmmmmmmm
I never built wxwidgets using code::blocks. Instead i use the makefiles.
But the dsw workspace should have been imported correctly...
Check the resource compiler's dirs...
Yiannis.
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]
and a replacement for the lib.exe (described below)[/list:u]
ok, lets begin with the installation of the above, the order shouldnt matter:
vc tooklit:
this should be pretty easy: install it first
then you need to set your environment variables (im sorry but i cant describe this one here because im using a foreign version of windows ;-) to contain the bin directory in the %path% variable, the include directory in %include% and the lib directiry in %lib% (you may need to create some of these variables)
platform sdk:
this should be the same as above :-)
nmake:
just extract them by executing the downloaded exe and put the extracted files to some folder included in your %path% variable (like the platform sdk\bin directory)
lib.exe:
there are 2 ways to solve the missing lib.exe problem:
1. create a text file in a %path% directory and rename it to "lib.bat", then put the following text into it
@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
/*
* 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 :-)
Quote from: MatrocWell 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 ) " 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?).
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 ;-)
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.
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)).
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.