Compiling in VC2005

Considering the failed initialization bug in the precompiled binary of .95, I decided I'd try compiling from scratch. I know the .95 announcement says that the code is meant to compile in VC 2003, but I'm afraid that I only have VC6 and the free 2005 Express (with platform SDK), so I thought I'd at least see try and see what happens.

The map compiler compiled just fine, but when I open up runtime\src\sylphis\sylphis.sln and build, I get one error:

------ Build started: Project: sylphis, Configuration: Debug Win32 ------
Performing Custom Build Step
The system cannot find the path specified.
Project : error PRJ0019: A tool returned an error code from "Performing Custom Build Step"
Creating browse information file...
Microsoft Browse Information Maintenance Utility Version 8.00.50727
Copyright (C) Microsoft Corporation. All rights reserved.
BSCMAKE: error BK1506 : cannot open file '.\debug\actormover.sbr': No such file or directory
Build log was saved at "file://c:\sylphis\runtime\src\sylphis\Debug\BuildLog.htm"
sylphis - 2 error(s), 0 warning(s)
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I can compile the hklib just fine, so it's something somewhere in the sylphis project. Any ideas?

-=Derek

By the way, I used the instructions here: http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/ to set up the platform SDK. Followed them exactly and did nothing extra.


Re: Compiling in VC2005

After a little scanning through the project, I saw "Sylphis.i". "Custom Build Steps" are typically used for stuff like this - generating swig interfaces, lexx, yacc, etc.

So I checked it's properties and sure enough it was trying to call something like "/python24/swig/swig/swig.exe blah blah". Oops. :)

I downloaded SWIG binaries from here:
http://sourceforge.net/project/showfiles.php?group_id=1645&package_id=81...

After unzipping, I added the folder containing swig.exe to VC's executables folder search list, changed the custom build step to read "swig.exe blah blah" (i.e. no path info), and boom, compilation!

Lemme know if it works for you too.

PS. Running the Sylphis.exe gives "Failed to import python importer". Never having used python before, I wonder how long it'll take me to fix. :(

I have SWIG included in the

I have SWIG included in the distribution of sylphis. However the debug version the custom build step tryies to use the "system wide" version of SWIG. The line "/python24/ bla bla" should be replaced with:


$(ProjectDir)\extern\tools\swig\swig -Wall -c++ -python -I..\ -o $(InputDir)\$(InputName)_wrap.cpp $(InputPath)

This custom build step generates two files the sylphis_wrap.cpp file and the sylphis.py. The second it created in the root directory of the source tree. You should copy this file in the runtime/system folder. If the sylphis_wrap.cpp that is compiled into sylphis.exe is not the save version as sylphis.py that is included by the python source you will get the "Failed to import python importer" error....

I was wondering about the

I was wondering about the swig.exe already in there. Any case, switching the build mode over to Release solves the problem.

But, not it seems I've run into another problem. Everything builds just fine until it gets to main.cpp:

------ Build started: Project: sylphis, Configuration: Release Win32 ------
Compiling...
main.cpp
.\core\src\main.cpp(23) : fatal error C1083: Cannot open include file: 'stackless_api.h': No such file or directory
Build log was saved at "file://c:\sylphis\runtime\src\sylphis\Release\BuildLog.htm"
sylphis - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

Now, I know(ish) what Stackless Python is, so I figured that "stackless_api.h" might just possibly have something to do with the Python sort of not-stacking. (Brilliant, no?) Yifes. Anyway, I download the source to Stackless, making sure I chose the Python 2.4.3 version (the Python I have installed).

I added to the VC includes dir, the Stackless\ dir that contains stackless_api.h. Now when I compile, I'm getting this error:

------ Build started: Project: sylphis, Configuration: Release Win32 ------
Compiling...
main.cpp
C:\Documents and Settings\Derek Mounce\Desktop\stackless-24-export\Stackless\stackless_api.h(45) : error C2143: syntax error : missing ';' before '*'
C:\Documents and Settings\Derek Mounce\Desktop\stackless-24-export\Stackless\stackless_api.h(45) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Documents and Settings\Derek Mounce\Desktop\stackless-24-export\Stackless\stackless_api.h(45) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Documents and Settings\Derek Mounce\Desktop\stackless-24-export\Stackless\stackless_api.h(52) : error C2065: 'task' : undeclared identifier
C:\Documents and Settings\Derek Mounce\Desktop\stackless-24-export\Stackless\stackless_api.h(52) : error C2065: 'args' : undeclared identifier
C:\Documents and Settings\Derek Mounce\Desktop\stackless-24-export\Stackless\stackless_api.h(52) : error C2275: 'PyObject' : illegal use of this type as an expression
c:\python24\include\object.h(104) : see declaration of 'PyObject'
C:\Documents and Settings\Derek Mounce\Desktop\stackless-24-export\Stackless\stackless_api.h(52) : error C2065: 'kwds' : undeclared identifier
C:\Documents and Settings\Derek Mounce\Desktop\stackless-24-export\Stackless\stackless_api.h(52) : error C2275: 'PyObject' : illegal use of this type as an expression
c:\python24\include\object.h(104) : see declaration of 'PyObject'
C:\Documents and Settings\Derek Mounce\Desktop\stackless-24-export\Stackless\stackless_api.h(52) : error C2491: 'PyTasklet_Setup' : definition of dllimport data not allowed
C:\Documents and Settings\Derek Mounce\Desktop\stackless-24-export\Stackless\stackless_api.h(52) : error C2078: too many initializers
C:\Documents and Settings\Derek Mounce\Desktop\stackless-24-export\Stackless\stackless_api.h(57) : error C2491: 'PyTasklet_Run' : definition of dllimport data not allowed
C:\Documents and Settings\Derek Mounce\Desktop\stackless-24-export\Stackless\stackless_api.h(57) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Build log was saved at "file://c:\sylphis\runtime\src\sylphis\Release\BuildLog.htm"
sylphis - 12 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

Messyessness. Is there something I need to do in regards to compiling Stackless Python first, or setting something somewhere else?

-=Derek

By the way, forgot to mention, before any of these other things, I had to add the Python24 include directory to the VC path. (Just for reference and clarity I say this...)

suppose that you have the

suppose that you have the source to stackless python to the folder spython/

you should then add the following include dirs :


spython/Include;spython/Stackless

That should work....

Aalllmost...

Yerfgergles. I only added Stackless\ to the include path, not also Include\. I don't see an spython directory anywhere already existing, so I'm supposing I have to create it. (Brilliant again, no?) Should I create it in the runtime\src\sylphis directoy, or elsewhere?

Anyway, just adding the Include\ directory got me a step further, and on to a new error in a new file:

------ Build started: Project: sylphis, Configuration: Release Win32 ------
Compiling...
main.cpp
Compiling resources...
.\core\src\sylphis.rc(10) : fatal error RC1015: cannot open include file 'afxres.h'.
Build log was saved at "file://c:\sylphis\runtime\src\sylphis\Release\BuildLog.htm"
sylphis - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

Just noticing, when I go to the properties of the sylphis.rc file, I see this:
/d "NDEBUG" /l 0x408 /fo".\Release/sylphis.res" /IE:\Python22\include

Might the E:\Python22\include be a sort of problem? I just taking kinda wild guesses here, because a programmer beyond Python and PHP I'm not, and C++ pointers remind me of shiny stars.

-=Derek

From what I see from you

From what I see from you build logs the paths are these :


C:\Documents and Settings\Derek Mounce\Desktop\stackless-24-export\Include
C:\Documents and Settings\Derek Mounce\Desktop\stackless-24-export\Stackless

Lol

Wow, somehow I totally misread your previous reply. I saw:
suppose that you have to add the source to stackless python to the folder spython/.

Oops.

Failed to import python importer

I have followed all the steps of the thread yet i get the above mentioned error. Any clue.

Solved

Yay dern diddly! I can now rule the world, I've compiled Sylphis!

Did a quick search on Google for afxres.h, and turned up a whole mess of issues just like what I was having. Seems that VC++ adds afxres.h to the resource file regardless of whether you're using MFC or not. Just had to add the [Platform SDK]/Includes/mfc to the VS includes directory, and all was fine.

Now, the truly awesome part: Sylphis now runs perfectly! (This the "Yay dern diddcly" --I save that for very rare occasions.) I didn't even have to create the empty base1.col from the disappearing terrain problem I was having.

I've uploaded a zip the of the sylphis.exe from my build. I'd be curious if anyone else who's been having troubles can run this build ok. http://www.fouressence.net/sylphis/builds/0.95/win32/sylphis-0.95-14apri...

Thanks for all the help! Now I can write a tutorial. :D

-=Derek

Tutor

Please write a tutorial.

Compile fine no back buffer update

I managed to compile Sylphis on VC 2005 with lots of warnings. It also seems that after building one configuration, say Debug, I have to clean and recompile the other - Release.

When I run the .exe, it opens fine but anything I move in the window leaves a trail as if the back buffer is not being cleared before the next render.

When I try to create an actor, I get a dialog that juts says "Python Exception"

The map compiler on the other hand compiles without errors or warnings.

PS: I'm using the version from SVN, I couldn't find the download at sourceforge, I guess it was removed after moving to SVN.

Likewise

Yups, I also get the repeating trails when just running sylphis.exe without loading a map, and I also get the Python Exception error when adding some of the entities.

I've been waiting to make sure I'm compiling Sylphis properly before I submit this as a bug. Suppose now's that time. :)

-=Derek