Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- al_test.o: In function `test_wave()':
- al_test.cpp:(.text+0x1a7): undefined reference to `min::wave::wave(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
- ...
- all: libmgl.a libmgl.so
- libmgl.so: $(OBJECTS)
- $(LD) $* $(LDFLAGS) -shared -o $@
- libmgl.a: $(OBJECTS)
- $(AR) $(ARFLAGS) libmgl.a $^
- %.o: %.cpp
- $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(INCLUDES) -c -o $@ $<
- #include <iostream>
- #include "twave.h"
- int main()
- {
- try
- {
- bool out = true;
- out = out && test_wave();
- // out = out && test_ogg();
- // out = out && test_sound_buffer();
- if (out)
- {
- std::cout << "Sound tests passed!" << std::endl;
- return 0;
- }
- }
- catch (std::exception &ex)
- {
- std::cout << ex.what() << std::endl;
- }
- std::cout << "Sound tests failed!" << std::endl;
- return -1;
- }
- #include <stdexcept>
- #include "min/wave.h"
- bool test_wave()
- {
- bool out = true;
- // Load invention wav file
- {
- const min::wave sound = min::wave("data/sound/invention_no_1.wav");
- // File should not be mono
- out = out && !sound.is_mono();
- if (!out)
- {
- throw std::runtime_error("Failed wave file not is_mono");
- }
- // Other checks that aren't important...
- }
- return out;
- }
- #ifndef __WAVE__
- #define __WAVE__
- #include <string>
- namespace min {
- class wave
- {
- private:
- void load(const std::string);
- public:
- wave(const std::string&);
- };
- }
- #endif
- #include "wave.h"
- min::wave::wave(const std::string &file)
- {
- load(file);
- }
- // Definition of `load` omitted; I don't think it's important,
- // but know that it is here
- g++ -c -Imin/ al_test.cpp -o al_test.o
- g++ al_test.o -L. -lmgl -lX11 -lGL -lfreetype -lopenal -lvorbisfile -o bin/al_test
- $(CXX) $* $(LDFLAGS) -shared -o $@
- g++ -L. -lmgl -lX11 -lGL -lfreetype -lopenal -lvorbisfile -o bin/al_test al_test.o
- g++ -c -Imin/ al_test.cpp -o al_test.o
Add Comment
Please, Sign In to add comment