Guest User

Untitled

a guest
Jul 17th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. al_test.o: In function `test_wave()':
  2. al_test.cpp:(.text+0x1a7): undefined reference to `min::wave::wave(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
  3. ...
  4.  
  5. all: libmgl.a libmgl.so
  6.  
  7. libmgl.so: $(OBJECTS)
  8. $(LD) $* $(LDFLAGS) -shared -o $@
  9.  
  10. libmgl.a: $(OBJECTS)
  11. $(AR) $(ARFLAGS) libmgl.a $^
  12.  
  13. %.o: %.cpp
  14. $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(INCLUDES) -c -o $@ $<
  15.  
  16. #include <iostream>
  17. #include "twave.h"
  18. int main()
  19. {
  20. try
  21. {
  22. bool out = true;
  23. out = out && test_wave();
  24. // out = out && test_ogg();
  25. // out = out && test_sound_buffer();
  26. if (out)
  27. {
  28. std::cout << "Sound tests passed!" << std::endl;
  29. return 0;
  30. }
  31. }
  32. catch (std::exception &ex)
  33. {
  34. std::cout << ex.what() << std::endl;
  35. }
  36.  
  37. std::cout << "Sound tests failed!" << std::endl;
  38. return -1;
  39. }
  40.  
  41. #include <stdexcept>
  42. #include "min/wave.h"
  43. bool test_wave()
  44. {
  45. bool out = true;
  46.  
  47. // Load invention wav file
  48. {
  49. const min::wave sound = min::wave("data/sound/invention_no_1.wav");
  50.  
  51. // File should not be mono
  52. out = out && !sound.is_mono();
  53. if (!out)
  54. {
  55. throw std::runtime_error("Failed wave file not is_mono");
  56. }
  57.  
  58. // Other checks that aren't important...
  59. }
  60.  
  61. return out;
  62. }
  63.  
  64. #ifndef __WAVE__
  65. #define __WAVE__
  66. #include <string>
  67. namespace min {
  68. class wave
  69. {
  70. private:
  71. void load(const std::string);
  72. public:
  73. wave(const std::string&);
  74. };
  75. }
  76. #endif
  77.  
  78. #include "wave.h"
  79.  
  80. min::wave::wave(const std::string &file)
  81. {
  82. load(file);
  83. }
  84.  
  85. // Definition of `load` omitted; I don't think it's important,
  86. // but know that it is here
  87.  
  88. g++ -c -Imin/ al_test.cpp -o al_test.o
  89. g++ al_test.o -L. -lmgl -lX11 -lGL -lfreetype -lopenal -lvorbisfile -o bin/al_test
  90.  
  91. $(CXX) $* $(LDFLAGS) -shared -o $@
  92.  
  93. g++ -L. -lmgl -lX11 -lGL -lfreetype -lopenal -lvorbisfile -o bin/al_test al_test.o
  94.  
  95. g++ -c -Imin/ al_test.cpp -o al_test.o
Add Comment
Please, Sign In to add comment