difficulty configuring for xcode

48 views
Skip to first unread message

Daniel Davies

unread,
Mar 19, 2020, 11:43:43 AM3/19/20
to SoLoud audio engine
Hi there thanks for accepting my join request, I really like the features of this library and I am trying to configure it to work with XCode 10.1 to implement audio in a game that I have been working on with sdl2.

I have tried to set up the lazy way by adding the source files directly to my project (specifically I added all the files from: core, backend/sdl, and audiosource/wav as well as all the header files from the include directory)

I am getting the following undefined symbol error when compiling after adding #define WITH_SDL2.

:-1: Undefined symbol: SoLoud::sdl2_init(SoLoud::Soloud*, unsigned int, unsigned int, unsigned int, unsigned int)


 I am still fairly new to c++ development so any help would be really appreciated!


Jari Komppa

unread,
Mar 19, 2020, 11:55:23 AM3/19/20
to Daniel Davies, SoLoud audio engine
The sdl2_init function is defined in soloud_sdl2.cpp in the backend/sdl folder. Make sure it's included.

--
You received this message because you are subscribed to the Google Groups "SoLoud audio engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to soloud+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/soloud/e94e9885-806a-45f8-94a4-4c396b0ad8c6%40googlegroups.com.

Daniel Davies

unread,
Mar 19, 2020, 12:20:58 PM3/19/20
to SoLoud audio engine
Yep, soloud_sdl2.cpp is included in my project...


the full error is as follows:

Undefined symbols for architecture x86_64:

  "SoLoud::sdl2_init(SoLoud::Soloud*, unsigned int, unsigned int, unsigned int, unsigned int)", referenced from:

      SoLoud::Soloud::init(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) in soloud.o

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)


On Thursday, 19 March 2020 15:55:23 UTC, Jari Komppa wrote:
The sdl2_init function is defined in soloud_sdl2.cpp in the backend/sdl folder. Make sure it's included.

On Thu, Mar 19, 2020 at 5:43 PM Daniel Davies <danield...@gmail.com> wrote:
Hi there thanks for accepting my join request, I really like the features of this library and I am trying to configure it to work with XCode 10.1 to implement audio in a game that I have been working on with sdl2.

I have tried to set up the lazy way by adding the source files directly to my project (specifically I added all the files from: core, backend/sdl, and audiosource/wav as well as all the header files from the include directory)

I am getting the following undefined symbol error when compiling after adding #define WITH_SDL2.

:-1: Undefined symbol: SoLoud::sdl2_init(SoLoud::Soloud*, unsigned int, unsigned int, unsigned int, unsigned int)


 I am still fairly new to c++ development so any help would be really appreciated!


--
You received this message because you are subscribed to the Google Groups "SoLoud audio engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sol...@googlegroups.com.
Message has been deleted

Daniel Davies

unread,
Mar 19, 2020, 2:24:26 PM3/19/20
to SoLoud audio engine
where should I be adding #define WITH_SDL2 
I suspect the problem might lie there, at the moment I am calling it in soloud.cpp

Jari Komppa

unread,
Mar 19, 2020, 2:38:34 PM3/19/20
to Daniel Davies, SoLoud audio engine
If you take a look at soloud_sdl2.cpp, you'll find that it defines sdl2_init both with and without WITH_SDL2, so you still have a problem that xcode is not including that file for some reason.

WITH_SDL2 should be set globally, i.e, for every source file, even though only a couple actually use it.

On Thu, Mar 19, 2020 at 8:24 PM Daniel Davies <danield...@gmail.com> wrote:
where should I be adding #define WITH_SDL2 
I suspect the problem might lie there, at the moment I am calling it in soloud.cpp

--
You received this message because you are subscribed to the Google Groups "SoLoud audio engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to soloud+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/soloud/1d8454ee-28df-430b-9c02-d4f883bc4724%40googlegroups.com.

Daniel Davies

unread,
Mar 19, 2020, 4:57:16 PM3/19/20
to SoLoud audio engine
huh oh yeah I see that... Idk what's going on then, I'll just keep messing with xcode, I've probably done something wrong.


On Thursday, 19 March 2020 18:38:34 UTC, Jari Komppa wrote:
If you take a look at soloud_sdl2.cpp, you'll find that it defines sdl2_init both with and without WITH_SDL2, so you still have a problem that xcode is not including that file for some reason.

WITH_SDL2 should be set globally, i.e, for every source file, even though only a couple actually use it.

On Thu, Mar 19, 2020 at 8:24 PM Daniel Davies <danield...@gmail.com> wrote:
where should I be adding #define WITH_SDL2 
I suspect the problem might lie there, at the moment I am calling it in soloud.cpp

--
You received this message because you are subscribed to the Google Groups "SoLoud audio engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sol...@googlegroups.com.

Daniel Davies

unread,
Mar 20, 2020, 9:29:09 AM3/20/20
to SoLoud audio engine
Ok, I figured I would try to set up visual studio code instead...
The good news is that after adding "-DWITH_SDL2" to the compiler args I'm no longer getting that undefined symbol error.
the bad news is I'm getting a new list of errors:

Undefined symbols for architecture x86_64:
  "_dll_SDL2_CloseAudioDevice", referenced from:
      SoLoud::soloud_sdl2_deinit(SoLoud::Soloud*) in soloud_sdl2-90d8e9.o
  "_dll_SDL2_InitSubSystem", referenced from:
      SoLoud::sdl2_init(SoLoud::Soloud*, unsigned int, unsigned int, unsigned int, unsigned int) in soloud_sdl2-90d8e9.o
  "_dll_SDL2_OpenAudioDevice", referenced from:
      SoLoud::sdl2_init(SoLoud::Soloud*, unsigned int, unsigned int, unsigned int, unsigned int) in soloud_sdl2-90d8e9.o
  "_dll_SDL2_PauseAudioDevice", referenced from:
      SoLoud::sdl2_init(SoLoud::Soloud*, unsigned int, unsigned int, unsigned int, unsigned int) in soloud_sdl2-90d8e9.o
  "_dll_SDL2_WasInit", referenced from:
      SoLoud::sdl2_init(SoLoud::Soloud*, unsigned int, unsigned int, unsigned int, unsigned int) in soloud_sdl2-90d8e9.o
  "_dll_SDL2_found", referenced from:
      SoLoud::sdl2_init(SoLoud::Soloud*, unsigned int, unsigned int, unsigned int, unsigned int) in soloud_sdl2-90d8e9.o
  "_stb_vorbis_close", referenced from:
      SoLoud::Wav::loadogg(SoLoud::MemoryFile*) in soloud_wav-bfef11.o
      SoLoud::WavStreamInstance::~WavStreamInstance() in soloud_wavstream-03748e.o
      SoLoud::WavStream::loadogg(SoLoud::File*) in soloud_wavstream-03748e.o
  "_stb_vorbis_get_frame_float", referenced from:
      SoLoud::Wav::loadogg(SoLoud::MemoryFile*) in soloud_wav-bfef11.o
      SoLoud::WavStreamInstance::getAudio(float*, unsigned int, unsigned int) in soloud_wavstream-03748e.o
  "_stb_vorbis_get_info", referenced from:
      SoLoud::Wav::loadogg(SoLoud::MemoryFile*) in soloud_wav-bfef11.o
      SoLoud::WavStream::loadogg(SoLoud::File*) in soloud_wavstream-03748e.o
  "_stb_vorbis_open_file", referenced from:
      SoLoud::WavStreamInstance::WavStreamInstance(SoLoud::WavStream*) in soloud_wavstream-03748e.o
      SoLoud::WavStream::loadogg(SoLoud::File*) in soloud_wavstream-03748e.o
  "_stb_vorbis_open_memory", referenced from:
      SoLoud::Wav::loadogg(SoLoud::MemoryFile*) in soloud_wav-bfef11.o
  "_stb_vorbis_seek_start", referenced from:
      SoLoud::WavStreamInstance::rewind() in soloud_wavstream-03748e.o
  "_stb_vorbis_stream_length_in_samples", referenced from:
      SoLoud::Wav::loadogg(SoLoud::MemoryFile*) in soloud_wav-bfef11.o
      SoLoud::WavStream::loadogg(SoLoud::File*) in soloud_wavstream-03748e.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any ideas what I could be doing wrong... I am trying to get this to work on a mac so I am surprised to see _dll_SDL2_ could the problem have something to do with that? sorry for asking so many questions, I'd really like to get this to work. 

Jari Komppa

unread,
Mar 20, 2020, 11:52:41 AM3/20/20
to Daniel Davies, SoLoud audio engine
Sounds like you're not including .c files in your build.

--
You received this message because you are subscribed to the Google Groups "SoLoud audio engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to soloud+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/soloud/c3c8cae4-6b37-4907-b6d8-da3814c96b07%40googlegroups.com.

Daniel Davies

unread,
Mar 20, 2020, 1:13:51 PM3/20/20
to SoLoud audio engine
Ahh, this was the problem it's finally working.
Thank you, you've been really helpful!

I also had to wrap the .c files in this. otherwise, my compiler was complaining.
#ifdef __cplusplus 
extern "C" {
#endif

... original content of headerfile goes here. 

#ifdef __cplusplus 
}
Reply all
Reply to author
Forward
0 new messages