bastienleonard / pysfml-cython

A Python 2/3 binding for SFML 2, written with Cython
http://pysfml2-cython.readthedocs.org/
Other
68 stars 8 forks source link

no member named 'BackSpace' in 'sf::Keyboard' #48

Closed Xavura closed 12 years ago

Xavura commented 12 years ago
src/sfml.cpp:57531:44: error: no member named 'BackSpace' in 'sf::Keyboard'; did you mean 'BackSlash'?
  __pyx_t_3 = PyInt_FromLong(sf::Keyboard::BackSpace); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                             ~~~~~~~~~~~~~~^~~~~~~~~
                                       BackSlash
/usr/local/include/SFML/Window/Keyboard.hpp:103:9: note: 'BackSlash' declared here
        BackSlash,    ///< The \ key
        ^
6 warnings and 1 error generated.
error: command 'clang' failed with exit status 1

Using the 2.0 installer here and pySFML 0.2.

I'm guessing the change in Keyboard (I read about it in another ticket) was recent and the SFML installer isn't up to date, so I'd need to build SFML from source or use pySFML 0.1.3?

Xavura commented 12 years ago

Answered my own question - yes I need to use 0.1.3. Presumably building SFML from source would also work.

bastienleonard commented 12 years ago

I'm going to create a branch that's compatible with the RC. I'll also upload compatible release. Thanks for reminding me :P

Xavura commented 12 years ago

Heh, no problem.

bastienleonard commented 12 years ago

Also, building pySFML from Git won't work because Git is intended to be in sync with the SFML repo. I'm not sure I will have the time to do the packaging until this weekend, we'll see.

bastienleonard commented 12 years ago

Mmh, just realized the previous post didn't make any sense so I reworded it. Also, I created the rc-compatible branch which should build against the SFML 2.0 RC. I'd be grateful if anyone could test it.

Xavura commented 12 years ago

Awesome, I'll test it soon.

shizmob commented 12 years ago

I just tested it and it compiled fine, gonna test run-time quality now.

shizmob commented 12 years ago

$ python test.py Traceback (most recent call last): File "test.py", line 1, in import sfml File "sfml.pyx", line 296, in init sfml (src/sfml.cpp:52259) NameError: declkey

gtoast commented 12 years ago

Just downloaded RC 2.0 from here and the 2.0 RC compatible PySFML from here and I'm getting this exact same error as OP:

src/sfml.cpp:57683:44: error: no member named 'BackSpace' in 'sf::Keyboard'; did you mean 'BackSlash'?
  __pyx_t_3 = PyInt_FromLong(sf::Keyboard::BackSpace); if (unlikely(!__pyx_t_3)) {__pyx_filename = ...
                             ~~~~~~~~~~~~~~^~~~~~~~~
                                           BackSlash                                               
/usr/local/include/SFML/Window/Keyboard.hpp:103:9: note: 'BackSlash' declared here
        BackSlash,    ///< The \ key
        ^
6 warnings and 1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
Xavura commented 12 years ago

Same.

Joes-Mac-Mini:pySFML-0.2.1 joe$ python setup.py build_ext

If the build fails, run patch.py and try again
----------------------------------------------

running build_ext
building 'sfml' extension
creating build
creating build/temp.macosx-10.8-x86_64-2.7
creating build/temp.macosx-10.8-x86_64-2.7/src
/usr/bin/clang -fno-strict-aliasing -Os -w -pipe -march=native -Qunused-arguments -mmacosx-version-min=10.8 -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/Cellar/python/2.7.3/include/python2.7 -c src/sfml.cpp -o build/temp.macosx-10.8-x86_64-2.7/src/sfml.o
src/sfml.cpp:57683:44: error: no member named 'BackSpace' in 'sf::Keyboard'; did you mean 'BackSlash'?
  __pyx_t_3 = PyInt_FromLong(sf::Keyboard::BackSpace); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                             ~~~~~~~~~~~~~~^~~~~~~~~
                                           BackSlash
/usr/local/include/SFML/Window/Keyboard.hpp:103:9: note: 'BackSlash' declared here
        BackSlash,    ///< The \ key
        ^
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
bastienleonard commented 12 years ago

I'm really busy because of work currently, I'll try to look into this tomorrow.

Xavura commented 12 years ago

Awesome, I look forward to testing it.

bastienleonard commented 12 years ago

Gah, again, I didn't have time yesterday. Sorry for the delay, hopefully I'll find the time when I'm back home. It should be a fast fix anyway.

bastienleonard commented 12 years ago

It looks like the sfml.cpp file included in the release doesn't match the source; if I generate it the binding works correctly. So if you have Cython installed, you can set USE_CYTHON = True in setup.py (or setup3k.py). Tomorrow I'll take the time to review the releases, figure out what went wrong and test them before making new ones. Again, sorry for the delay.

For Windows users, this shouldn't be a problem, as these installers are up to date and work correctly: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pysfml

shizmob commented 12 years ago

Oh yes, I'm terribly sorry for that -- I didn't include the new sfml.cpp in my commit/pull request.

bastienleonard commented 12 years ago

I uploaded new RC-compatible source releases. Let me know if you encounter any problems.

FuzzWool commented 12 years ago

I had a Backspace tantrum on my Mac, too. Just tried running this new release and everything appears to have clicked into place, as it works with all the tests and my Windows pySFML2 code. Thank you very much for this fix.

bastienleonard commented 12 years ago

I just realized that the master branch still had the RC keyboard constant, for some reason, which is pretty confusing. To be clear, in the C++ SFML 2 RC, the constant for back space is Back, and it was renamed to BackSpace pretty recently. This breaks compatibility, so I made a new branch, rc-compatible, that still references Back and will build correctly. This doesn't change the Python API; you should be able to use BACK_SPACE everywhere. The master branch is kept up to date and should build with the latest C++ SFML code from Git.

Another source of incompatibility is the removal of the default font. I decided to remove it in rc-compatible as well, because it seems more simple to keep the same API for both branches.