error: ‘setUpVector’ is not a member of ‘sf::Listener’
Trying to build dsfml on Ubuntu 18.04 x64 with gdc, getting error (same with rdmd):
‘setUpVector’ is not a member of ‘sf::Listener’
[user]~/Downloads/d/dsfml/DSFML20190323>git clone https://github.com/Jebbs/DSFML.git
[user]~/Downloads/d/dsfml/DSFML20190323>cd DSFML
[user]~/Downloads/d/dsfml/DSFML20190323/DSFML>gdc build.d -obuild
[user]~/Downloads/d/dsfml/DSFML20190323/DSFML>./build
Building for Linux with gdc
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/Downloads/d/dsfml/DSFML20190323/DSFML/src/DSFMLC
Scanning dependencies of target dsfmlc-system
[ 3%] Building CXX object System/CMakeFiles/dsfmlc-system.dir/Err.cpp.o
[ 6%] Building CXX object System/CMakeFiles/dsfmlc-system.dir/ErrStream.cpp.o
[ 9%] Building CXX object System/CMakeFiles/dsfmlc-system.dir/String.cpp.o
[ 9%] Built target dsfmlc-system
Scanning dependencies of target dsfmlc-audio
[ 12%] Building CXX object Audio/CMakeFiles/dsfmlc-audio.dir/Listener.cpp.o
/home/user/Downloads/d/dsfml/DSFML20190323/DSFML/src/DSFMLC/Audio/Listener.cpp: In function ‘void sfListener_setUpVector(float, float, float)’:
/home/user/Downloads/d/dsfml/DSFML20190323/DSFML/src/DSFMLC/Audio/Listener.cpp:77:19: error: ‘setUpVector’ is not a member of ‘sf::Listener’
sf::Listener::setUpVector(x,y,z);
^~~~~~~~~~~
/home/user/Downloads/d/dsfml/DSFML20190323/DSFML/src/DSFMLC/Audio/Listener.cpp: In function ‘void sfListener_getUpVector(float*, float*, float*)’:
/home/user/Downloads/d/dsfml/DSFML20190323/DSFML/src/DSFMLC/Audio/Listener.cpp:84:26: error: ‘getUpVector’ is not a member of ‘sf::Listener’
temp = sf::Listener::getUpVector();
^~~~~~~~~~~
Audio/CMakeFiles/dsfmlc-audio.dir/build.make:62: recipe for target 'Audio/CMakeFiles/dsfmlc-audio.dir/Listener.cpp.o' failed
make[2]: *** [Audio/CMakeFiles/dsfmlc-audio.dir/Listener.cpp.o] Error 1
CMakeFiles/Makefile2:140: recipe for target 'Audio/CMakeFiles/dsfmlc-audio.dir/all' failed
make[1]: *** [Audio/CMakeFiles/dsfmlc-audio.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
What version of SFML are you building with? Those functions should be part of SFML 2.4, which this version of DSFML is based on.
I don't know what I'm doing :)
Do I need to install libsfml (and libcsfml) beforehand? I did [re]install libsfml-* and tried again using HEAD, i.e. without -b 2.1 --depth 1.
DSFMLC built and installed fine, DSFML again gives the error from above.
dsfmlc said during installation '2.1', is that right?
-- Installing: /usr/local/lib/libdsfmlc-system.so.2.1
-- Up-to-date: /usr/local/lib/libdsfmlc-system.so.2
-- Up-to-date: /usr/local/lib/libdsfmlc-system.so
I have sfml 2.4 libs installed, for example: /usr/lib/x86_64-linux-gnu/libsfml-system.so.2.4
but also the dsfmlc 2.1 libs, for example: /usr/local/lib/libdsfmlc-system.so.2.1
It seems that you're mixing different versions of things, which really means that there aren't good instructions available. That's on me.
I've been working on new instructions and tutorials for the website, and I'll go ahead and publish what I have later today. It should allow you to build something with DSFML 2.4
Note: The following builds the 2.1 version specifically. If you want to build git HEAD, just use git clone https://github.com/Jebbs/DSFMLC.git
That's what I used and it built and installed, though version 2.1 it seems. Now I tried using -b 2.4 explicitly but I get build errors after make:
/home/user/Downloads/d/dsfml/DSFML20190423/DSFMLC/src/SFML/Window/Unix/GlxExtensions.hpp:123:3: error: conflicting declaration ‘typedef struct GLXHyperpipeNetworkSGIX GLXHyperpipeNetworkSGIX’
I also had to install xcb-image and udev libs for cmake succeed first.
The project has changed significantly since v2.1, so I suggest you try to build with v2.4.
The 2.4 branch is actually out of date and should be removed, but the master branch should work just fine. If you look at the new tutorials, they should give you enough information. Just substitute any non-existent tags/branches for master.
Just an FYI, the new website is very much a work in progress and most of it is not ready. These tutorials should be close enough to get you started, though.
Let me know if this works for you and sorry about taking so long to reply.
Thank you!
I could build dsfml now with the instructions from Linux and GDC, but using git clone https://github.com/jebbs/dsfml instead. But I don't know what to use for dmd ... -L-LDSFMLC\lib\ ... to compile the example. Should I still build dsfmlc separately?
Ah, that's a typo in the instructions.DSFMLC is no longer a separate library, it's built as part of DSFML and embedded into the DSFML static libraries. You'll want the linker path to point to your SFML location.
I tried without -L-LDSFMLC\lib\:
dmd test.d -Idsfml/src/ -L-Ldsfml/lib/ -L-ldsfml-graphics -L-ldsfml-window -L-ldsfml-system -L-lsfml-graphics -L-lsfml-window -L-lsfml-system
...
/usr/bin/ld: dsfml/lib//libdsfml-system.a(ErrStream.cpp.o): undefined reference to symbol '_ZNSt15basic_streambufIcSt11char_traitsIcEE7seekoffElSt12_Ios_SeekdirSt13_Ios_Openmode@@GLIBCXX_3.4'
//usr/lib/x86_64-linux-gnu/libstdc++.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
I tried adding -L-lstdc++ (and installed libstdc++-6-dev) but same errors.
Where at in your command line did you add libstdc++? I don't think it will work unless it's the last library included.
dmd test.d -Idsfml/src -L-Ldsfml/lib -L-ldsfml-graphics -L-ldsfml-window -L-ldsfml-system -L-lsfml-graphics -L-lsfml-window -L-lsfml-system -L-lstdc++
ok, different error now, about lockingTextWriter (my dmd version is DMD64 D Compiler v2.085.1):
[user]~/Downloads/d/dsfml/DSFML20190429>dmd test.d -Idsfml/src -L-Ldsfml/lib -L-ldsfml-graphics -L-ldsfml-window -L-ldsfml-system -L-lsfml-graphics -L-lsfml-window -L-lsfml-system -L-lstdc++
dsfml/src/dsfml/window/event.d(354): Deprecation: struct `dsfml.window.event.Event.MouseWheelEvent` is deprecated - This event is deprecated and potentially inaccurate. Use MouseWheelScrollEvent instead.
dsfml/src/dsfml/window/event.d(354): Deprecation: struct `dsfml.window.event.Event.MouseWheelEvent` is deprecated - This event is deprecated and potentially inaccurate. Use MouseWheelScrollEvent instead.
dsfml/src/dsfml/graphics/renderwindow.d(493): Deprecation: dsfml.graphics.renderwindow.RenderWindow.setJoystickThreshhold is overriding the deprecated method dsfml.window.window.Window.setJoystickThreshhold
dsfml/src/dsfml/graphics/renderwindow.d(493): Deprecation: dsfml.graphics.renderwindow.RenderWindow.setJoystickThreshhold cannot be marked as deprecated because it is overriding a function in the base class
dsfml/src/dsfml/graphics/renderwindow.d(536): Deprecation: dsfml.graphics.renderwindow.RenderWindow.setTitle is overriding the deprecated method dsfml.window.window.Window.setTitle
dsfml/src/dsfml/graphics/renderwindow.d(548): Deprecation: dsfml.graphics.renderwindow.RenderWindow.setTitle is overriding the deprecated method dsfml.window.window.Window.setTitle
dsfml/src/dsfml/graphics/renderwindow.d(645): Deprecation: dsfml.graphics.renderwindow.RenderWindow.create is overriding the deprecated method dsfml.window.window.Window.create
dsfml/src/dsfml/graphics/renderwindow.d(645): Deprecation: dsfml.graphics.renderwindow.RenderWindow.create cannot be marked as deprecated because it is overriding a function in the base class
dsfml/src/dsfml/graphics/renderwindow.d(654): Deprecation: dsfml.graphics.renderwindow.RenderWindow.create is overriding the deprecated method dsfml.window.window.Window.create
test.d(7): Deprecation: constructor `dsfml.graphics.renderwindow.RenderWindow.__ctor!char.this` is deprecated - Use the constructor that takes a 'const(dchar)[]' instead.
dsfml/lib/libdsfml-graphics.a(image.o): In function `_D5dsfml8graphics5image5Image13getPixelArrayMxFZAxh':
image.d:(.text+0x37a): undefined reference to `_D3std5stdio4File17lockingTextWriterMFNfZS3std5stdio4File17LockingTextWriter'
image.d:(.text+0x3b9): undefined reference to `_D3std5stdio4File17LockingTextWriter7handle_MFNdNeZPS4core4stdc5stdio8_IO_FILE'
image.d:(.text+0x3e4): undefined reference to `_D3std5stdio4File17LockingTextWriter7handle_MFNdNeZPS4core4stdc5stdio8_IO_FILE'
....
Could my dmd.conf be messing something up (I think it's unchanged/original)?
[user]~/Downloads/d/dsfml/DSFML20190429>cat /etc/dmd.conf
;
; dmd.conf file for dmd
;
; dmd will look for dmd.conf in the following sequence of directories:
; - current working directory
; - directory specified by the HOME environment variable
; - directory dmd resides in
; - /etc directory
;
; Names enclosed by %% are searched for in the existing environment and inserted
;
; The special name %@P% is replaced with the path to this file
;
[Environment32]
DFLAGS=-I/usr/include/dmd/phobos -I/usr/include/dmd/druntime/import -L-L/usr/lib/i386-linux-gnu -L--export-dynamic
[Environment64]
DFLAGS=-I/usr/include/dmd/phobos -I/usr/include/dmd/druntime/import -L-L/usr/lib/x86_64-linux-gnu -L--export-dynamic -fPIC
That almost looks like it isn't linking with the standard library. When you installed dmd, did you also install libphobos?
phobos seems to be installed, and I can compile other d code, even using std.stdio.File.lockingTextWriter:
[user]~/Downloads/d/dsfml/DSFML20190429>cat test_phobos.d
void main() {
import std.stdio;
File f = File("test_phobos.d");
writeln(f);
auto ltw = f.lockingTextWriter();
writeln(ltw);
}
[user]~/Downloads/d/dsfml/DSFML20190429>dmd test_phobos.d
[user]~/Downloads/d/dsfml/DSFML20190429>./test_phobos
File(561481FB50A0, "test_phobos.d")
LockingTextWriter(File(561481FB50A0, "test_phobos.d"), 0, '\0')
[user]~/Downloads/d/dsfml/DSFML20190429>
If you can compile and link something outside of DSFML then I'm not sure what could be the problem. The only thing I can think to suggest would be do a fresh/clean build and see if that works.
If you still have problems, let me know what distro you're using and I'll see if I can reproduce.
Hello there. I have the same problem, but with WAY MORE "undefined reference". It was a pain to install because my SFML was 2.5 and I needed to go back to 2.4 (because of the original subject with audio listener). If you can find a solution (or just update dsfml with sfml 2.5) that would be great ! I will try some things and if I found a solution I let you know. I'm on Debian Buster.