2017-01-25 6 views
-2

만드는 동안 - "나쁜 할당의"UHD 라이브러리와 함께 작업하는 동안. 나쁜 할당 C에서 USRP 개체 ++ 내가 오류를 받고 있어요

은 내가 UHD 라이브러리에 대한 자세한 내용은 몇 가지 기본적인 코드를 컴파일하기 위해 노력하고있어. 프로그램을 컴파일 한 후 오류가 발생합니다.

코드 :

int UHD_SAFE_MAIN(int argc, char *argv[]) { 
uhd::set_thread_priority_safe(); 

std::string device_args("addr=192.168.10.2"); 
std::string subdev("A:0"); 
std::string ant("TX/RX"); 
std::string ref("internal"); 

double rate(1e6); 
double freq(915e6); 
double gain(10); 
double bw(1e6); 

//create a usrp device 
std::cout << std::endl; 
std::cout << boost::format("Creating the usrp device with: %s...") %device_args << std::endl; 
uhd::usrp::multi_usrp::sptr usrp = uhd::usrp::multi_usrp::make(device_args); 


// Lock mboard clocks 
std::cout << boost::format("Lock mboard clocks: %f") % ref << std::endl; 
usrp->set_clock_source(ref); 

//always select the subdevice first, the channel mapping affects the other settings 
std::cout << boost::format("subdev set to: %f") % subdev << std::endl; 
usrp->set_rx_subdev_spec(subdev); 
std::cout << boost::format("Using Device: %s") % usrp->get_pp_string() << std::endl; 

//set the sample rate 
if (rate <= 0.0) { 
    std::cerr << "Please specify a valid sample rate" << std::endl; 
    return ~0; 
} 

// set sample rate 
std::cout << boost::format("Setting RX Rate: %f Msps...") % (rate/1e6) << std::endl; 
usrp->set_rx_rate(rate); 
std::cout << boost::format("Actual RX Rate: %f Msps...") % (usrp->get_rx_rate()/1e6) << std::endl << std::endl; 

// set freq 
std::cout << boost::format("Setting RX Freq: %f MHz...") % (freq/1e6) << std::endl; 
uhd::tune_request_t tune_request(freq); 
usrp->set_rx_freq(tune_request); 
std::cout << boost::format("Actual RX Freq: %f MHz...") % (usrp->get_rx_freq()/1e6) << std::endl << std::endl; 

// set the rf gain 
std::cout << boost::format("Setting RX Gain: %f dB...") % gain << std::endl; 
usrp->set_rx_gain(gain); 
std::cout << boost::format("Actual RX Gain: %f dB...") % usrp->get_rx_gain() << std::endl << std::endl; 

// set the IF filter bandwidth 
std::cout << boost::format("Setting RX Bandwidth: %f MHz...") % (bw/1e6) << std::endl; 
usrp->set_rx_bandwidth(bw); 
std::cout << boost::format("Actual RX Bandwidth: %f MHz...") % (usrp->get_rx_bandwidth()/1e6) << std::endl << std::endl; 

// set the antenna 
std::cout << boost::format("Setting RX Antenna: %s") % ant << std::endl; 
usrp->set_rx_antenna(ant); 
std::cout << boost::format("Actual RX Antenna: %s") % usrp->get_rx_antenna() << std::endl << std::endl; 

return EXIT_SUCCESS; 

} 오류가 발생한 코드의

부 :

//create a usrp device 
std::cout << std::endl; 
std::cout << boost::format("Creating the usrp device with: %s...") %device_args << std::endl; 
uhd::usrp::multi_usrp::sptr usrp = uhd::usrp::multi_usrp::make(device_args); 

오류 : enter image description here

내가 사용 :

  • 의 Microsoft Visual C++ Express를 2010
  • C++ 언어
  • UHD 라이브러리, Win32_VS2010.exe, 003.007.003 출시 내 컴퓨터에 어떤 URSP 장치를 연결하지 마십시오 1_63_0
  • 부스트 라이브러리.

오류가 UHD 라이브러리 또는 C++ 언어와 연결되어 있는지 여부를 알 수 없습니다. 나는 다른 버전의 Microsoft Visual Studio와 다른 버전의 UHD 라이브러리 (최신 버전 포함)를 사용하여이 프로그램을 컴파일하려고했습니다. 나는 다른 PC에서 이것을 컴파일하려고 시도했지만 결과는 비슷했다. 프로그램을 중단시키는 오류가 없었지만 콘솔에 문자열 "error : bad allocation"이 표시되었고 프로그램이 같은 지점에서 작동을 멈췄다.

이 프로그램을 처음 컴파일하기 시작할 때 "잘못된 할당 오류"(UHD_003.004.000 - 릴리스)가 없었습니다. LookupError : KeyError를 : ----->에 대한 찾을 수 없습니다 장치 그 후 나는 새로운 일 (003.007.003) 다음 나쁜 내 UHD 라이브러리 버전을 업그레이드하기로 결정했습니다. "오류 - 나는 말했다 오류가있어 할당 오류 내가 이전 버전을 다시 설치하려고했지만 도움이되지 않았다. 발생하는 시작했다.

내가 좋아하는, UHD :: device_addr_t문자열에서, device_args의 유형을 변경하려고했다 그것은 http://files.ettus.com/manual에 대한 설명서에 있다고하지만, 오류가 사라지지 않았다.

도움을 주시면 감사하겠습니다.

답변

0

"컴퓨터에 URSP 장치를 연결하지 않았습니다."

당신은 당신이 그것을 실행중인 컴퓨터에 연결된 USRP없이이 코드를 실행할 수 없습니다.

전화 할 때 UHD : USRP :: multi_usrp : (device_args를) 만들; uhd가 장치 args에서 지정한 IP 주소로 USRP에 연결하려고합니다.

usrp를 컴퓨터에 연결하고 다시 시도하십시오.