Jetson Utils videoSource

Hello again,

I am trying to compile and run a script that was actually given as an example on the Jetson Inference. The script is using the videoSource in Jetson Utils.

The issue is that when I try to compile using:
nvcc camera.cu -o camera
I get an error as such:
/tmp/tmpxft_000059f3_00000000-10_camera.o: In function main': tmpxft_000059f3_00000000-5_camera.cudafe1.cpp:(.text+0x58): undefined reference to videoSource::Create(int, char**, int)’
tmpxft_000059f3_00000000-5_camera.cudafe1.cpp:(.text+0x6c): undefined reference to `videoOutput::Create(int, char**, int)’
collect2: error: ld returned 1 exit status

The code:
#include <jetson-utils/videoSource.h>
#include <jetson-utils/videoOutput.h>

int main( int argc, char** argv )
{
// create input/output streams
videoSource* input = videoSource::Create(argc, argv, ARG_POSITION(0));
videoOutput* output = videoOutput::Create(argc, argv, ARG_POSITION(1));

if( !input )
	return 0;

// capture/display loop
while( true )
{
	uchar3* image = NULL;  // can be uchar3, uchar4, float3, float4
	int status = 0;        // see videoSource::Status (OK, TIMEOUT, EOS, ERROR)
	
	if( !input->Capture(&image, 1000, &status) )  // 1000ms timeout
	{
		if( status == videoSource::TIMEOUT )
			continue;
			
		break; // EOS
	}

	if( output != NULL )
	{
		output->Render(image, input->GetWidth(), input->GetHeight());

		if( !output->IsStreaming() )  // check if the user quit
			break;
	}
}

// destroy resources
SAFE_DELETE(input);
SAFE_DELETE(output);

}

Is there something I am missing?

Thanks <3

Hi @jpbaehr13, you need to link to the jetson-utils library. Can you try this?

nvcc camera.cu -ljetson-utils -o camera
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.