arjun.a
embed files
325bfe1
raw
history blame
4.44 kB
Ticket Name: Linux/TDA2: some question about add some code in origin sample code
Query Text:
Part Number: TDA2 Tool/software: Linux Hi, i want to add some code with own head & c file. I include head file in origin code and add the file path in the NAKEFILE.MK, then make them i got "undefined reference to 'function_name' ". Should i need modify other files to make sure compiler link correctly? thanks, Chen-Wei
Responses:
Hi Chen-Wei , Which location are you adding . Have you verified if the file is compiling after addition in the make file . Share more details so that we can help you better. Regards Chetan.M
Hi Chetan, My sample code is opencvcanny. Put my own code (head file and source code)in the folder of canny and add the path to MAKEFILE.MK after include just like " INCLUDE+= -I$(ipc_PATH)/hlos_common/include -I$(ipc_PATH)/packages -I$(kernel_PATH)/include/generated/uapi $(OSA_INC) -I$(ipc_PATH)/linux/include -I$($(MAKEAPPNAME)_PATH) -I$(OPENCV_INCLUDE) -I$(vision_sdk_PATH)/apps/src/hlos/adas/src/alg_plugins/opencvcanny/include " i checked my code is compiled after addition in the make file, but can't link to my function. Thanks, Chen-Wei
Hi Chen-Wei, All OPENCV_LIBS are linked in "common_footer_a15.mk" file under vision_sdk\build\hlos\makerules\linux folder Regards Surya
Hi, Surya Thanks for told me OPENCV_LIBS are linked in where, but in my situation is i want add some own function in the sample code of canny. It means that we want do some modify in the sample code(call other sub function in a new head file, which is created by me). which files should i need to modify to avoid the error i meet ? thanks, Chen-Wei
Chen Wei , Do you mean canny algorithm .. ? Or canny alg plugin. can you please send the entire error Regards Chetan.M
Hi Chetan, i want to add some code to the origin code in canny usecase, origin modify #include "iCanny.h" #include "iCanny.h" #include "opencv2/imgproc.hpp" #include "opencv2/imgproc.hpp" #include "/tda/vision_sdk/apps/src/hlos/adas/src/alg_plugins /opencvcanny/include/hllow_world.h" void iCanny(IplImage *inputImage, IplImage *outputImage) void iCanny(IplImage *inputImage, IplImage *outputImage) { { UInt32 lowThresh; UInt32 lowThresh; UInt32 highThresh; UInt32 highThresh; cv::Mat inputMat = cv::cvarrToMat(inputImage, false); cv::Mat inputMat = cv::cvarrToMat(inputImage, false); cv::Mat outputMat = cv::cvarrToMat(outputImage, false); cv::Mat outputMat = cv::cvarrToMat(outputImage, false); lowThresh = 30; lowThresh = 30; highThresh = lowThresh * 3; highThresh = lowThresh * 3; cv::Canny(inputMat, outputMat, lowThresh, highThresh, 3); cv::Canny(inputMat, outputMat, lowThresh, highThresh, 3); hw(); } } and entire error is : /tda/vision_sdk/binaries/apps/tda2xx_evm_linux_opencx/lib/tda2xx-evm/a15_0/release/apps.a(canny.o): In function `iCanny': canny.cpp:(.text+0x5e): undefined reference to `hw()' Thanks, Chen-Wei
Hi , Where is the function hw() Regards Chetan.M
Hi Chetan, the function hw() is in /tda/vision_sdk/apps/src/hlos/adas/src/alg_plugins/opencvcanny/include/hllow_world.h and i also add " /tda/vision_sdk/apps/src/hlos/adas/src/alg_plugins/opencvcanny/include/" in MAKEFILE.MK thanks, Chen-Wei
where is it implemented .? Its present in which .a lib . Regards Chetan.M
Hi Chetan, this is created by myself. Should i need to build them as a .a or .lib file and add them in MAKEFILE.MK? Thanks, Chen-Wei
Chen-Wei sorry for repeated asking same question , where is the hw() declared and where is it defined . ? Regards Chetan.M
Hi Chetan, i declared it in /tda/vision_sdk/apps/src/hlos/adas/src/alg_plugins/opencvcanny/include/hllow_world.h and defined it in /tda/vision_sdk/apps/src/hlos/adas/src/alg_plugins/opencvcanny/hllow_world.c Thanks, Chen-Wei
Hi Chen-Wei, I see a C and CPP file combination , Have you taken care of extern c and other parameters in your hllow_world files .? Try google search and see if some thing missed. stackoverflow.com/.../call-a-c-function-from-c-code Regards Chetan.M
Hi, Chetan Thanks for your suggest, and i add the extern C in my code. I think maybe i need to compile them first, just like the website you gave build my code into a .o file and link them, or maybe not. If i build my code, i don't know the path of .o file should add in which file to make them linked. if i don't build them first, i still got the same error Should i need modify any files? Thanks, Chen-Wei
Please try a clean build