wangkexue / eulerian-video-magnification

eulerian video magnification c++ implementation with OpenCV
9 stars 4 forks source link

cannot compile code #1

Closed AdrienLemaire closed 9 years ago

AdrienLemaire commented 9 years ago

Hi, I tried to run your code, without success. I'm on arch linux, using g++ 4.9.2. Any idea what is wrong below?

~/P/3/eulerian-video-magnification git:master ❯❯❯ g++ main.cpp $(pkg-config --cflags --libs python2) -o output
In file included from /usr/include/python2.7/Python.h:8:0,
                 from main.cpp:14:
/usr/include/python2.7/pyconfig.h:1182:0: warning: "_POSIX_C_SOURCE" redefined
 #define _POSIX_C_SOURCE 200112L
 ^
In file included from /usr/include/c++/4.9.2/x86_64-unknown-linux-gnu/bits/os_defines.h:39:0,
                 from /usr/include/c++/4.9.2/x86_64-unknown-linux-gnu/bits/c++config.h:430,
                 from /usr/include/c++/4.9.2/iostream:38,
                 from main.cpp:9:
/usr/include/features.h:225:0: note: this is the location of the previous definition
 # define _POSIX_C_SOURCE 200809L
 ^
In file included from /usr/include/python2.7/Python.h:8:0,
                 from main.cpp:14:
/usr/include/python2.7/pyconfig.h:1204:0: warning: "_XOPEN_SOURCE" redefined
 #define _XOPEN_SOURCE 600
 ^
In file included from /usr/include/c++/4.9.2/x86_64-unknown-linux-gnu/bits/os_defines.h:39:0,
                 from /usr/include/c++/4.9.2/x86_64-unknown-linux-gnu/bits/c++config.h:430,
                 from /usr/include/c++/4.9.2/iostream:38,
                 from main.cpp:9:
/usr/include/features.h:166:0: note: this is the location of the previous definition
 # define _XOPEN_SOURCE 700
 ^
main.cpp: In function ‘int main(int, const char**)’:
main.cpp:134:18: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
     char* baby = "baby.mp4";
                  ^
main.cpp:135:20: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
     char* subway = "subway.mp4";
                    ^
main.cpp: In function ‘char* amplify_spatial_lpyr_temporal_butter(const char*, const char*, int, int, float, float, int, float, char*)’:
main.cpp:294:53: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
     b0_obj = PyMapping_GetItemString(main_dict, "b0");
                                                     ^
main.cpp:295:53: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
     a0_obj = PyMapping_GetItemString(main_dict, "a0");
                                                     ^
main.cpp:296:53: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
     b1_obj = PyMapping_GetItemString(main_dict, "b1");
                                                     ^
main.cpp:297:53: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
     a1_obj = PyMapping_GetItemString(main_dict, "a1");
                                                     ^
main.cpp:307:53: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
     b0_obj = PyMapping_GetItemString(main_dict, "b0");
                                                     ^
main.cpp:308:53: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
     a0_obj = PyMapping_GetItemString(main_dict, "a0");
                                                     ^
main.cpp:309:53: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
     b1_obj = PyMapping_GetItemString(main_dict, "b1");
                                                     ^
main.cpp:310:53: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
     a1_obj = PyMapping_GetItemString(main_dict, "a1");
                                                     ^
main.cpp:331:31: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
     pos = strrchr(vidFile, '/');

Thanks !

wangkexue commented 9 years ago

I havn't seen this until now, mainly because I'm watching other projects which has many pull requests. I know it's too late, just in case you're still interested in this issue. Try to change line 326

char* pos;

to

const char* pos;