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

  • Home
  • SEARCH
  • 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 6583841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:27:42+00:00 2026-05-25T16:27:42+00:00

I get several compile errors if I compile the following function in Visual Studio

  • 0

I get several compile errors if I compile the following function in Visual Studio 2005:

void search()
{
    deviceEventHandle = CreateEvent(NULL, FALSE, FALSE, "foundDevice");

    BTUINT32 deviceClass = 0; // 0 represents all classes 
    BTUINT16 maxDevices = 200; // 0 represents an unlimited number of responses
    BTUINT16 maxDuration = 45; // maxDuration * 1.28 = number of seconds
    Btsdk_StartDeviceDiscovery(deviceClass, maxDevices, maxDuration);

    WaitForSingleObject(deviceEventHandle, INFINITE);

    if (deviceEventHandle != NULL) {
        CloseHandle(deviceEventHandle);
        deviceEventHandle = NULL;
    }
}

These are the errors I get:

error C2275: 'BTUINT32' : illegal use of this type as an expression 
error C2146: syntax error : missing ';' before identifier 'deviceClass'     
error C2065: 'deviceClass' : undeclared identifier
error C2275: 'BTUINT16' : illegal use of this type as an expression     
error C2146: syntax error : missing ';' before identifier 'maxDevices'      
error C2065: 'maxDevices' : undeclared identifier   
error C2275: 'BTUINT16' : illegal use of this type as an expression     
error C2146: syntax error : missing ';' before identifier 'maxDuration'     
error C2065: 'maxDuration' : undeclared identifier  

If I comment out the line containing the CreateEvent call the code compiles without errors:

void search()
{
    //deviceEventHandle = CreateEvent(NULL, FALSE, FALSE, "foundDevice");

    BTUINT32 deviceClass = 0; // 0 represents all classes 
    BTUINT16 maxDevices = 200; // 0 represents an unlimited number of responses
    BTUINT16 maxDuration = 45; // maxDuration * 1.28 = number of seconds
    Btsdk_StartDeviceDiscovery(deviceClass, maxDevices, maxDuration);

    WaitForSingleObject(deviceEventHandle, INFINITE);

    if (deviceEventHandle != NULL) {
        CloseHandle(deviceEventHandle);
        deviceEventHandle = NULL;
    }


}

These are the headers I use:

#include <winsock2.h>
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <conio.h>
#include "Btsdk_ui.h"

I compile the code as C code (/TC) in Visual Studio 2005. The “Btsdk_ui.h” file is part of the BlueSoleil bluetooth stack and inlcudes another file that contains definitions of BTUINT32 and BTUINT16.

All suggestions are welcome.

  • 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-05-25T16:27:42+00:00Added an answer on May 25, 2026 at 4:27 pm

    When compiling C code, MSVC doesn’t allow declarations to be mixed with statements – declarations can only be at the start of a block (MSVC follows more closely to the ANSI/ISO C90 standard than the C99 standard).

    Try:

    void search()
    {
    
        BTUINT32 deviceClass = 0; // 0 represents all classes 
        BTUINT16 maxDevices = 200; // 0 represents an unlimited number of responses
        BTUINT16 maxDuration = 45; // maxDuration * 1.28 = number of seconds
    
        deviceEventHandle = CreateEvent(NULL, FALSE, FALSE, "foundDevice");
    
        Btsdk_StartDeviceDiscovery(deviceClass, maxDevices, maxDuration);
    
        WaitForSingleObject(deviceEventHandle, INFINITE);
    
        if (deviceEventHandle != NULL) {
            CloseHandle(deviceEventHandle);
            deviceEventHandle = NULL;
        }
    
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm following several tutorials and references trying to get my kernel set up. I've
I'm looking for a way to visualize compiler errors in Visual Studio. I'm working
I get several results with the same outputs. I want to get jack,jane only
How can I get several GridViews on a single page to share the same
I published several free and paid app in the Market. I recently get several
I have several listboxes that get each of their data from a separate stored
Several of my ajax applications in the past have used GET request but now
I get a random issue with VS2008 (although not that random several times a
How would you get a reference to an executing class several stack frames above
I have to use several SOAP messages to get data from a web service.

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.