Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8734377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:49:48+00:00 2026-06-13T09:49:48+00:00

I want to create some modules for my program. I want to call a

  • 0

I want to create some modules for my program. I want to call a function and pass a vector as a parameter. The return value should also be a vector.

My code looks like this

main.cpp
//BlueSmart.cpp : Definiert den Einstiegspunkt für die Konsolenanwendung.
#include "stdafx.h"

#define WIN32_LEAN_AND_MEAN

using namespace std;

#pragma comment(lib, "Irprops.lib")



BLUETOOTH_FIND_RADIO_PARAMS m_bt_find_radio = {
sizeof(BLUETOOTH_FIND_RADIO_PARAMS)
};

BLUETOOTH_RADIO_INFO m_bt_info = {
sizeof(BLUETOOTH_RADIO_INFO),
0,
};

BLUETOOTH_DEVICE_SEARCH_PARAMS m_search_params = {
sizeof(BLUETOOTH_DEVICE_SEARCH_PARAMS),
1,
0,
1,
1,
1,
15,
NULL
};

BLUETOOTH_DEVICE_INFO m_device_info = {
sizeof(BLUETOOTH_DEVICE_INFO),
0,
};

HANDLE m_radio = NULL;
HBLUETOOTH_RADIO_FIND m_bt = NULL;
HBLUETOOTH_DEVICE_FIND m_bt_dev = NULL;

int wmain(int argc, wchar_t **args) {

while(true) {
m_bt = BluetoothFindFirstRadio(&m_bt_find_radio, &m_radio);

do {
  localBluetoothDevices ();

  m_search_params.hRadio = m_radio;
  ::ZeroMemory(&m_device_info, sizeof(BLUETOOTH_DEVICE_INFO));
  m_device_info.dwSize = sizeof(BLUETOOTH_DEVICE_INFO);
  m_bt_dev = BluetoothFindFirstDevice(&m_search_params, &m_device_info);

  vector<wstring> vec;
  int m_device_id = 0;
  do {
   wostringstream tmp;
   ++m_device_id;
   //Something like this <----------------------------------------
   externBluetoothDevices (vec);
   //Something like this <----------------------------------------

      wprintf(L"********************************************************************** \n");
   wprintf(L"\tDevice %d:\r\n", m_device_id);
   wprintf(L"\t\tName: %s\r\n", m_device_info.szName);
   wprintf(L"\t\tAddress: %02x:%02x:%02x:%02x:%02x:%02x\r\n", m_device_info.Address.rgBytes[0], m_device_info.Address.rgBytes[1], m_device_info.Address.rgBytes[2], m_device_info.Address.rgBytes[3], m_device_info.Address.rgBytes[4], m_device_info.Address.rgBytes[5]);
   wprintf(L"====================================================================== \n");


   for (int i = 0; i < 6; i++) {
    tmp << hex << m_device_info.Address.rgBytes [i];
    if (i < 5)
     tmp << L':';
   }

   vec.push_back(tmp.str());

  } while(BluetoothFindNextDevice(m_bt_dev, &m_device_info));


  BluetoothFindDeviceClose(m_bt_dev);
  //Sleep(10*1000*60);
  Sleep(10000);

} while(BluetoothFindNextRadio(&m_bt_find_radio, &m_radio));
BluetoothFindRadioClose(m_bt);
}
return 0;
}

//Lokal verfügbare bzw. angeschlossene Bluetooth-Devices
void localBluetoothDevices (){
  int m_radio_id = 0;
  m_radio_id++;
  BluetoothGetRadioInfo(m_radio, &m_bt_info);      
  //Lokaler Bluetoothadapter
  wprintf(L"====================================================================== \n");
  wprintf(L"Local Device Nr. %d\n", m_radio_id);
  wprintf(L"\tName: %s\r\n", m_bt_info.szName);
  wprintf(L"\tAddress: %02x:%02x:%02x:%02x:%02x:%02x\r\n",      m_bt_info.address.rgBytes[0], m_bt_info.address.rgBytes[1], m_bt_info.address.rgBytes[2], m_bt_info.address.rgBytes[3], m_bt_info.address.rgBytes[4], m_bt_info.address.rgBytes[5]);

 }

//Extern verfügbare bzw. Bluetooth-Devices
 vector<wstring> externBluetoothDevices (vector<wstring> &vec){
return vec;
 }

stdafx.h

 #pragma once

 #include "targetver.h"

 #include <stdio.h>
 #include <tchar.h>
 #include <winsock2.h>
 #include <windows.h>
 #include <stdlib.h>
 #include <bthdef.h>
 #include <BluetoothAPIs.h>
 #include <iostream>
 #include <vector>
 #include <algorithm>
 #include <string>
 #include <sstream>
 #include <iomanip>
 #include <conio.h>

 void localBluetoothDevices ();
 vector<wstring> externBluetoothDevices (vector<wstring>);

It says that vector is not a known type. What am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T09:49:49+00:00Added an answer on June 13, 2026 at 9:49 am

    In stdafx.h replace

    vector<wstring> externBluetoothDevices (vector<wstring>);
    

    with

    std::vector<std::wstring> externBluetoothDevices (std::vector<std::wstring>);
    

    Basically the issue was although you put using namespace std; in your cpp file that doesn’t count in your header file which is before the using declaration is seen.

    Also note that your defintion in the cpp file is different. In the cpp file you have a reference

    vector<wstring> externBluetoothDevices (vector<wstring>&);
    

    Decide which you really want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create some function for rendering images from within Joomla v1.5.23. That
I want to create some kind of AJAX script or call that continuously will
I want to create some DOM nodes with jQuery, append them to the html
I want to create some diagrams for some papers. Diagrams will contain some text,
I want to create some table through PHP but it fails everytime, but the
I want to create some files at WEB-INF/upload and upload is a folder which
I want to create some textured rectangles (I guess the jargon for this is
I want to create some tests for my app and I have the following
I want to create some simple navigation in sencha touch 2. I have questions
So I have Html like this http://trac.edgewall.org/wiki/RecentChanges (I want to create some Flash Track

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.