leadedge / ofxNDI

An Openframeworks addon to allow sending and receiving images over a network using the NewTek Network Device Protocol.
GNU General Public License v3.0
134 stars 48 forks source link

undeclared identifiers on OSX #15

Closed clankill3r closed 4 years ago

clankill3r commented 4 years ago

hi, first off all, I have very little experience with c++ and openframeworks, so keep that in mind.

I try to use ofxNDI on mac osx, but I get the following errors:

/Data/of_v0.10.0_osx_release/addons/ofxNDI/src/ofxNDIreceive.cpp:179:33: error: use of undeclared identifier 'timeGetTime' startTime = lastTime = (double)timeGetTime(); ^ /Data/of_v0.10.0_osx_release/addons/ofxNDI/src/ofxNDIreceive.cpp:342:17: error: use of undeclared identifier 'timeGetTime' dwStartTime = timeGetTime(); ^ /Data/of_v0.10.0_osx_release/addons/ofxNDI/src/ofxNDIreceive.cpp:346:20: error: use of undeclared identifier 'timeGetTime' dwElapsedTime = timeGetTime() - dwStartTime; ^ /Data/of_v0.10.0_osx_release/addons/ofxNDI/src/ofxNDIreceive.cpp:444:4: error: use of undeclared identifier 'strcpy_s' strcpy_s(sendername, maxsize, senderName.c_str()); ^ /Data/of_v0.10.0_osx_release/addons/ofxNDI/src/ofxNDIreceive.cpp:460:3: error: use of undeclared identifier 'strcpy_s' strcpy_s(sendername, maxsize, NDIsenders.at(index).c_str()); ^ /Data/of_v0.10.0_osx_release/addons/ofxNDI/src/ofxNDIreceive.cpp:633:32: error: use of undeclared identifier 'timeGetTime' dwStartTime = (unsigned int)timeGetTime(); ^ /Data/of_v0.10.0_osx_release/addons/ofxNDI/src/ofxNDIreceive.cpp:636:35: error: use of undeclared identifier 'timeGetTime' dwElapsedTime = (unsigned int)timeGetTime() - dwStartTime; ^ /Data/of_v0.10.0_osx_release/addons/ofxNDI/src/ofxNDIreceive.cpp:940:11: warning: 4 enumeration values not handled in switch: 'NDIlib_frame_type_none', 'NDIlib_frame_type_error', 'NDIlib_frame_type_status_change'... [-Wswitch] switch (NDI_frame_type) { ^ /Data/of_v0.10.0_osx_release/addons/ofxNDI/src/ofxNDIreceive.cpp:940:11: note: add missing switch cases switch (NDI_frame_type) { ^ /Data/of_v0.10.0_osx_release/addons/ofxNDI/src/ofxNDIreceive.cpp:911:7: warning: unused variable 'bRet' [-Wunused-variable] bool bRet = false; ^ /Data/of_v0.10.0_osx_release/addons/ofxNDI/src/ofxNDIreceive.cpp:1090:15: error: use of undeclared identifier 'floor' frameRate = floor(1.0 / frameTime + 0.5); ^ /Data/of_v0.10.0_osx_release/addons/ofxNDI/src/ofxNDIreceive.cpp:1103:2: error: unknown type name 'LARGE_INTEGER' LARGE_INTEGER li; ^ /Data/of_v0.10.0_osx_release/addons/ofxNDI/src/ofxNDIreceive.cpp:1119:2: error: unknown type name 'LARGE_INTEGER' LARGE_INTEGER li;

I am not really sure how to approach from here, so any help is welcome.

best Doeke

leadedge commented 4 years ago

In 2017 Thomas Lengeling made changes for OSX. Since then there have been other changes for Linux as well as additions for fps calculations and I do not have a setup to keep it updated and tested.

With the changes for Linux, I note throughout "#if !defined(TARGET_WIN32) && !defined (TARGET_OSX)". If you change that to "#if !defined(TARGET_WIN32)", this should resolve TimeGetTime and sprintf_s.

However, the counters also have to be changed and attention to types as well. This has been done by Amaury Hazan for another project "ShaderMaker" and the necessary code can be found in the 1.6 branch (https://github.com/leadedge/ShaderMaker/tree/ffgl1.6). The counters are replaced by std::chrono functions along with other things and these changes could be transferred.

The warning "enumeration values not handled in switch" can be fixed by including the missing values but it should work without them.

Meanwhile you could comment out all the counter functions. Fps will not be calculated but that is not so important. This might get you going until I can make the necessary changes.

leadedge commented 4 years ago

Try "std::floor" instead of just "floor" and let me know if that works.

leadedge commented 4 years ago

I have updated the ARM/Linux "testing" branch with the suggested changes. It builds OK for Windows. Please let me know any compile errors reported.

leadedge commented 4 years ago

Closing old issue.