dji-sdk / FlightRecordParsingLib

DJI Flight Record Parsing Lib
Other
39 stars 12 forks source link

Compile error on Ubuntu #1

Closed jeryini closed 1 year ago

jeryini commented 1 year ago

Hello!

When running sh generate.sh on Ubuntu to compile the program, I'm getting the following error:

[ 72%] Building CXX object StandardizationCppBuild/StandardizationBuild/CMakeFiles/FlightRecordStandardization.dir/model/common/fr_standardization_common.cpp.o
/home/jernej/git/FlightRecordParsingLib/dji-flightrecord-kit/source/FlightRecordStandardization/model/common/fr_standardization_common.cpp: In constructor ‘DJIFR::standardization::Buffer::Buffer(void*, size_t)’:
/home/jernej/git/FlightRecordParsingLib/dji-flightrecord-kit/source/FlightRecordStandardization/model/common/fr_standardization_common.cpp:88:18: error: ‘malloc’ was not declared in this scope
   88 |     void *temp = malloc(length);
      |                  ^~~~~~
/home/jernej/git/FlightRecordParsingLib/dji-flightrecord-kit/source/FlightRecordStandardization/model/common/fr_standardization_common.cpp:10:1: note: ‘malloc’ is defined in header ‘<cstdlib>’; did you forget to ‘#include <cstdlib>’?
    9 | #include <string.h>
  +++ |+#include <cstdlib>
   10 | 
/home/jernej/git/FlightRecordParsingLib/dji-flightrecord-kit/source/FlightRecordStandardization/model/common/fr_standardization_common.cpp: In lambda function:
/home/jernej/git/FlightRecordParsingLib/dji-flightrecord-kit/source/FlightRecordStandardization/model/common/fr_standardization_common.cpp:91:9: error: ‘free’ was not declared in this scope
   91 |         free(ptr);
      |         ^~~~
/home/jernej/git/FlightRecordParsingLib/dji-flightrecord-kit/source/FlightRecordStandardization/model/common/fr_standardization_common.cpp:91:9: note: ‘free’ is defined in header ‘<cstdlib>’; did you forget to ‘#include <cstdlib>’?
/home/jernej/git/FlightRecordParsingLib/dji-flightrecord-kit/source/FlightRecordStandardization/model/common/fr_standardization_common.cpp: In constructor ‘DJIFR::standardization::Buffer::Buffer(size_t)’:
/home/jernej/git/FlightRecordParsingLib/dji-flightrecord-kit/source/FlightRecordStandardization/model/common/fr_standardization_common.cpp:97:18: error: ‘calloc’ was not declared in this scope
   97 |     void *temp = calloc(length, 1);
      |                  ^~~~~~
/home/jernej/git/FlightRecordParsingLib/dji-flightrecord-kit/source/FlightRecordStandardization/model/common/fr_standardization_common.cpp: In lambda function:
/home/jernej/git/FlightRecordParsingLib/dji-flightrecord-kit/source/FlightRecordStandardization/model/common/fr_standardization_common.cpp:99:9: error: ‘free’ was not declared in this scope
   99 |         free(ptr);
      |         ^~~~
/home/jernej/git/FlightRecordParsingLib/dji-flightrecord-kit/source/FlightRecordStandardization/model/common/fr_standardization_common.cpp:99:9: note: ‘free’ is defined in header ‘<cstdlib>’; did you forget to ‘#include <cstdlib>’?
make[2]: *** [StandardizationCppBuild/StandardizationBuild/CMakeFiles/FlightRecordStandardization.dir/build.make:146: StandardizationCppBuild/StandardizationBuild/CMakeFiles/FlightRecordStandardization.dir/model/common/fr_standardization_common.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:209: StandardizationCppBuild/StandardizationBuild/CMakeFiles/FlightRecordStandardization.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
DJI-William commented 1 year ago

The lastest version is 1.0.4. I know there is somethring wrong with the docker, but I havn't tried on Ubuntu yet. I am pretty sure Mac is working now.

jeryini commented 1 year ago

Yes I managed to build it using @WBawa fix.

DJI-William commented 1 year ago

@jeryini Great, I will push the dev team to merge his PR soon.

DJI-William commented 1 year ago

@jeryini merged, you can close the issue now.

jeryini commented 1 year ago

Thank you, marked as resolved.