SFML community forums
Bindings - other languages => DotNet => Topic started by: farnoy on August 14, 2011, 08:23:23 pm
-
Hi,
I was using SFML 2.0 with C++, but now i wanted to change for C#. I'm using mono and I've compiled SFML.Net with Tao framework. I've copied csfml-window lib at version 1.99.git20110616-1 with command:
cp /usr/lib/libcsfml-window.so ./libcsfml-window-2.so
Following output appears:
Mono: DllImport attempting to load: 'csfml-window-2'.
Mono: DllImport loading library: '/home/kuba/devel/SFML.Net/examples/window/libcsfml-window-2'.
Mono: Searching for 'sfWindow_Create'.
Mono: Probing 'sfWindow_Create'.
Mono: Found as 'sfWindow_Create'.
mono: symbol lookup error: /home/kuba/devel/SFML.Net/examples/window/libcsfml-window-2: undefined symbol: _ZNK2sf6Window8GetInputEv
I don't know where to go from now. Using libraries for windows doesn't seem reasonable and I would bet on version differences. Isn't SFML.Net edge aiming 2.0?
-
I don't know if Mono wants Linux shared libraries or Windows DLLs. Try to recompile CSFML for Linux, and replace the CSFML DLLs with it.
-
It's loading csfml, but fails to find something inside, so what csfml version is SFML.Net targeting?
-
It's loading csfml
Are you sure? The lib is not named libcsfml-window-2.
so what csfml version is SFML.Net targeting?
The one which is provided in its exlibs directory.
-
/usr/lib/libcsfml-window.so => /usr/lib/libcsfml-window.so.2 => /usr/lib/libcsfml-window.so.2.0
I'll try to recompile edge version of CSFML, the one I have is from 16th June, maybe something changes from that date.
-
Yeah... This is one that you compiled yourself, SFML.Net is supposed to use the latest version of SFML (I always keep them synchronized).
-
I can't compile CSFML:
kuba:CSFML$ make
Found SFML: /usr/include
-- Configuring done
CMake Error at cmake/Macros.cmake:58 (add_library):
Cannot find source file:
/home/kuba/devel/CSFML/src/SFML/Graphics/RenderImage.cpp
Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
.hxx .in .txx
Call Stack (most recent call first):
src/SFML/Graphics/CMakeLists.txt:44 (csfml_add_library)
It would look like there's old SFML CMakeLists.txt and new files (not RenderImage, but RenderTexture), when I rename files in CMakeLists to use those texture files it fails with:
In file included from /home/kuba/devel/CSFML/src/SFML/Graphics/FontStruct.h:32:0,
from /home/kuba/devel/CSFML/src/SFML/Graphics/Font.cpp:29:
/home/kuba/devel/CSFML/src/SFML/Graphics/TextureStruct.h:31:37: fatal error: SFML/Graphics/Texture.hpp: No such file or directory
compilation terminated.
-
Sorry, a file was outdated. It's fixed now.
-
Pulled your changes, but I'm still getting similar error:
[ 51%] Building CXX object src/SFML/Graphics/CMakeFiles/csfml-graphics.dir/Font.cpp.o
In file included from /home/kuba/devel/CSFML/src/SFML/Graphics/FontStruct.h:32:0,
from /home/kuba/devel/CSFML/src/SFML/Graphics/Font.cpp:29:
/home/kuba/devel/CSFML/src/SFML/Graphics/TextureStruct.h:31:37: fatal error: SFML/Graphics/Texture.hpp: No such file or directory
compilation terminated.
Edit:
And then when I copy Texture.hpp to CSFML/src/SFML/Graphics I get this:
/home/kuba/devel/CSFML/src/SFML/Graphics/Font.cpp: In function ‘const sfTexture* sfFont_GetTexture(sfFont*, unsigned int)’:
/home/kuba/devel/CSFML/src/SFML/Graphics/Font.cpp:154:54: error: ‘class sf::Font’ has no member named ‘GetTexture’
Are you changing spec for 2.0 with deleting GetTexture() from sf::Font? If so, documentation is not refreshed and I think and bindings are outdated. http://www.sfml-dev.org/documentation/2.0/classsf_1_1Font.php#a0879bdd56d69b22fb93d0948150e0d10
Edit2:
Seems like developing using unstable bindings won't work here, but there are no tags on git for earlier version, like 1.6.
-
Now it's your version of SFML which is not up-to-date.
Bindings are stable, just pull the latest revision of everything.
-
The Texture.hpp header is up to date from git. Is CSFML using SFML from /usr/include (installed on system)?
-
The Texture.hpp header is up to date from git
How can it be up-to-date, the compiler doesn't even find it?
Is CSFML using SFML from /usr/include (installed on system)?
Yes.
-
Texture.hpp wast taken from git repo of SFML.
So the issue lies in outdated sfml on my system (28th July).
-
Yup, everything is working fine now, only when building audio binding in CSFML:
In file included from /home/kuba/devel/CSFML/src/SFML/Audio/SoundRecorder.cpp:28:0:
/home/kuba/devel/CSFML/include/SFML/Audio/SoundRecorder.h:36:66: error: ‘size_t’ has not been declared
I don't need audio lib atm so I'll try with SFML.Net now.
-
Working fine, thanks for your help. Now I don't have to worry about C++.
-
Scratch that, something's wrong again with simple test:
static void Main()
{
RenderWindow window = new RenderWindow(new VideoMode(800, 600, 32), "SFML.Net Window", Styles.Default, new ContextSettings(32, 32, 16, 0, 1));
Sprite circleSprite = new Sprite(new Texture(@"content\circleSprite.png"));
while (window.IsOpened())
{
window.Clear(new Color(0, 0, 0));
window.Draw(circleSprite);
window.Display();
}
}
Output:
/usr/bin/mono: symbol lookup error: /home/kuba/devel/galaxier/galaxier/bin/Debug/libcsfml-graphics-2.so: undefined symbol: _ZN2sf7TextureC1Ev
Similar happens when trying to run shader demo:
mono: symbol lookup error: /home/kuba/devel/sfml/SFML.Net/examples/shader/libcsfml-graphics-2.so: undefined symbol: _ZN2sf13RenderTextureC1Ev
I'll just use the 1.6 version until 2.0 becomes stable
-
It is stable, you just fail to build/configure/use the whole thing properly ;)
From the error messages, I'd say that you're using CSFML libraries from an older revision (without the sf::Texture class).
-
I'm building and installing SFML, then CSFML and then SFML.Net, everything is compiled from newest sources. I checked csfml-graphics with `nm` and it shows about 10 undefined symbols. Something's using Window.GetInput() but it's no longer present in CSFML, because you replaced it with Keyboard, Joystick classes (as far as I know).
-
There's nothing in CSFML sources that's still using the old sf::Input class. I noticed that Input.h is still there (I'll remove it as soon as I come home), but it only contains functions declarations, no code calling sf::Input.
-
Can you tell me where those undefined functions are called in the source code? So that we can see if it's your version which is outdated, or me being totally blind :)
-
It's working again... I just copied the same things to MonoDevelop project, but there's this: yesterday I flagged csfml package as out-of-date, today this package has been updated to newest available, so I know what was wrong.
SFML.Net used CSFML from the same dir, but also used SFML from system? I don't know what the update did, because I manually installed SFML before this update, but it's fine now and I won't touch this again until 3.0.
Maybe I should've done `make install --prefix /usr`, but I'm not sure at this point. Anyway, thanks for the help.