Being new to C++, I'm having trouble understanding how to compile, build and link to libraries. I was able to get SFML working more out of luck than actually understanding the core concepts. Now that I'm trying to install sfeMovie, I'm hitting a wall. I've been at this for a few hours, so I'll go over the steps I took, and would love any pointers in the right direction.
Step 1: dynamic linkingI grabbed the download
here under binaries. Then, I added the libsfe-movie.dylib to Xcode under Target -> Summary -> Linked Frameworks and Libraries. I added the header file to the project as well. The project was built successfully, but threw a warning that the file format was not correct for the architecture being linked (x86_64). Changing my project to 32-bit got rid of the warning, but caused a fatal error when running.
Question 1: My assumption at this point is that my options are to compile SFML as 32-bit, or to compile sfeMovie as 64-bit. Is that correct, or are there other factors at play?
Step 2: Using build.shI took the approach of trying to compile sfeMovie on my own. I tried both the beta file and the current Git repo. In terminal, I placed:
sudo bash build.sh macosx -arch x86_64
For both attempts, a ton of errors were thrown. Sample of errors:
ormat/avformat.h:1374: error: expected declaration specifiers or ‘...’ before ‘int64_t’
./libavformat/avformat.h:1384: error: expected declaration specifiers or ‘...’ before ‘int64_t’
./libavformat/avformat.h:1393: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_gen_search’
./libavformat/avformat.h:1552: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘parse_date’
./libavformat/avformat.h:1558: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_gettime’
make: *** [libavdevice/alldevices.o] Error 1
*** an error occured, aborting.
Question 2: The only thing I could think of here is that I'm not using GCC. Is it used by default if I have it installed, or do I have to specify it? Or, is that a false lead, and is something else causing the errors?
Step 3: using CMakeI basically tried the same approach I used to install SFML. opened CMake, set the Git folder to the source path, tried both Debug and Release, and set the architecture to both Default and x86_64. Hit Configure again, and then generate. Went to the directory in terminal, ran a make clean and then a sudo make install. Sample errors are:
/Users/veeneck/GameDev/sfeMovieGit/src/Movie.cpp:402: error: ‘av_malloc’ cannot be used as a function
/Users/veeneck/GameDev/sfeMovieGit/src/Movie.cpp:421: error: ‘cerr’ is not a member of ‘std’
/Users/veeneck/GameDev/sfeMovieGit/src/Movie.cpp:421: error: ‘endl’ is not a member of ‘std’
/Users/veeneck/GameDev/sfeMovieGit/src/Movie.cpp: In member function ‘bool sfe::Movie::SaveFrame(AVPacket*)’:
/Users/veeneck/GameDev/sfeMovieGit/src/Movie.cpp:450: error: ‘cerr’ is not a member of ‘std’
make[2]: *** [CMakeFiles/sfe-movie.dir/src/Movie.cpp.o] Error 1
make[1]: *** [CMakeFiles/sfe-movie.dir/all] Error 2
make: *** [all] Error 2
Question 3: At this point, I'm just copy/pasting from the SFML install tutorial. Can someone explain the different concepts going on between step 2 and step 3?
And lastly, 2 more follow up questions.
Question 4: Any tips on other approaches I should try?
Question 5: Does anyone have a favorite article, tutorial or book on building, compiling, static linking, dynamic linking and frameworks?
Thanks a ton.