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 8975791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:58:10+00:00 2026-06-15T18:58:10+00:00

I have a file.cpp which i’m porting to linux from windows. I’ve changed all

  • 0

I have a file.cpp which i’m porting to linux from windows. I’ve changed all the specific headers and functions, but I still got this error. here’s my code.

#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
#define _CRT_SECURE_NO_DEPRECATE 1

#include <stdio.h>
#include <curses.h>
#include <termios.h>
#include <term.h>
#include <unistd.h>

#include "BioPlux.h"

#define BUF_SIZ 1000

static struct termios initial_settings, new_settings;
static int peek_character = -1;

int kbhit();

int kbhit()
{
    char ch;
    int nread;

    if(peek_character != -1)
        return 1;
    new_settings.c_cc[VMIN]=0;
    tcsetattr(0, TCSANOW, &new_settings);
    nread = read(0,&ch,1);
    new_settings.c_cc[VMIN]=1;
    tcsetattr(0, TCSANOW, &new_settings);

    if(nread == 1) {
        peek_character = ch;
        return 1;
    }
    return 0;
}

int main()
{
   BP::Device::Frame frames[BUF_SIZ];

   FILE *f = fopen("teste.txt", "w");

   BP::Device *dev = NULL;

   try
   {
      // decomment next block to search for bioPlux devices
      /*
      std::vector<std::string> devs;
      BP::Device::FindDevices(devs);
      fprintf(f, "FindDevices: %d\n", devs.size());
      for(int i=0; i < devs.size(); i++)
          fprintf(f, "%s\n", devs[i].c_str());
      */

      dev = BP::Device::Create("00:07:80:40:DD:D8");  // put here the MAC address of your device

      std::string str;
      dev->GetDescription(str);
      printf("Description: %s\n", str.c_str());
      fprintf(f, "# Description: %s\n", str.c_str());

      dev->SetDOut(true); // put the digital output at HIGH - useless

      dev->BeginAcq(); // 1000 Hz, 12 bits, 6/8 channels
      //dev->BeginAcq(1000, 0x01, 12); // 1000 Hz, 12 bits, channel 1 only

      //for(int k = 0; k < 10; k++) // total 10 seconds
      while(!kbhit())
      {
         dev->GetFrames(BUF_SIZ, frames); // block for 1 sec
         putchar('*');
         for(int i=0; i < BUF_SIZ; i++) // while the data to file
         {
            fprintf(f, "%i", frames[i].seq);
            for(int j = 0; j < 8; j++)
               fprintf(f, "\t%i", frames[i].an_in[j]);
            fputc('\n', f);
         }
      }      

      dev->EndAcq();
   } // end try

   catch (BP::Err err)
   {
      char const *typ;
      switch(err.GetType())
      {
      case BP::Err::TYP_ERROR:
         typ = "Error";
         break;
      case BP::Err::TYP_NOTIFICATION:
         typ = "Notification";
         break;
      }
      printf("Error: %d Type: %s - %s\n", err.code, typ, err.GetDescription());
   }

   if (dev) delete dev;
    fclose(f);
   return 0;
}

this is the file.cpp which includes the following header above. The class is defined in here.

#include <vector>
#include <string>
#include <inttypes.h>

typedef unsigned char    BYTE;
typedef unsigned short   WORD;

#ifndef _BIOPLUXHEADER_
#define _BIOPLUXHEADER_

namespace BP
{
   class Device
   {
   public:
      struct Frame
      {
         BYTE  seq;
         bool  dig_in;
         WORD  an_in[8];
      };

      static void    FindDevices(std::vector<std::string> &devs);
      static Device* Create(const std::string &port);

      virtual void   GetDescription(std::string &str)=0;
      virtual void   BeginAcq(void)=0;
      virtual void   BeginAcq(int freq, BYTE chmask, BYTE nbits)=0;
      virtual void   GetFrames(int nframes, Frame *frames)=0;
      virtual void   SetDOut(bool dout)=0;
      virtual void   EndAcq(void)=0;
      virtual        ~Device() {}
   };

   class Err
   {
   public:
      enum Code {
         // Notifications
           //BT_AUTHENTICATION,
           BT_ADDRESS = 1,
           BT_ADAPTER_NOT_FOUND,
           BT_DEVICE_NOT_FOUND,
           CONTACTING_DEVICE,
           PORT_COULD_NOT_BE_OPENED,
         // Errors
           PORT_INITIALIZATION,
           //FIRMWARE_NOT_SUPPORTED,
           DEVICE_NOT_IDLE,
           DEVICE_NOT_IN_ACQUISITION_MODE,
           PORT_COULD_NOT_BE_CLOSED,
           BT_DEVICE_NOT_PAIRED,
         INVALID_PARAMETER,
         FUNCTION_NOT_SUPPORTED
      } code;

      enum Type {
         TYP_ERROR,
         TYP_NOTIFICATION
      };

      Err(Code c) : code(c) {}
      Type        GetType(void);
      const char* GetDescription(void);
   };
}

#endif

this is an outpu from the compilation try:

samuelpedro@ubuntu:~/Desktop/bioPlux API/C++$ g++ -o bttest_simple bttest_simple.cpp -lbluetooth BioPlux.lib
/tmp/cccJUI8I.o: In function `main':
bttest_simple.cpp:(.text+0xf8): undefined reference to `BP::Device::Create(std::string const&)'
bttest_simple.cpp:(.text+0x426): undefined reference to `BP::Err::GetType()'
bttest_simple.cpp:(.text+0x459): undefined reference to `BP::Err::GetDescription()'
collect2: error: ld returned 1 exit status
  • 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-15T18:58:12+00:00Added an answer on June 15, 2026 at 6:58 pm

    Your definition of class BP::Device contains a declaration of a method named Create(), but no code for it, so it has to be defined in some source file somewhere. Does your Windows build include a source file with its definition? Because your link apparently does not include that file, if it exists. If you’re using Visual Studio, you’ll have to add that file to your project, or else add a library that includes it.

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

Sidebar

Related Questions

I have a cpp file from which I am generating a shared library (using
Here's the use case: I have a .cpp file which has functions implemented in
I have a .cpp file which has some static free functions. I know how
I have a file.cpp which as an file.h included. This works on windows. Is
I have a large C++ file (SS.cpp) which I decided to split in smaller
I have a simple cpp file which uses GIO. I have stripped out everything
I have the following code in one cpp file which is part of a
I have a very simple C++ file Multiplier.cpp with the corresponding header file, from
I have a file A.cpp which has the following lines: #includeB.h int main(int argc,
Suppose I have a .cpp file in which I have to include a third-party

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.