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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:37:32+00:00 2026-06-15T09:37:32+00:00

I am trying to enhance a small C++ project with CUDA. My project is

  • 0

I am trying to enhance a small C++ project with CUDA.
My project is using a custom library’s classes and functions for example Matrix3d, Vector3d, Plane2d etc. They are mostly geometric objects.

When I try to use my code in the device (either __host__ __device__ functions or a kernel) all the library functions/objects are considered as host code and I get multiple warnings and errors for example error: identifier "Plane3d::~Plane3d" is undefined in device code

Is there a way to use my library on device as well? How is it done?
I don’t have experience on CUDA and C++ (I have only used CUDA with simple C code without classes) so I don’t get the strategy very well.

Is there a method to avoid changing the library source code? It is possible to change the library’s code but it would be better if I could avoid it.

Thanks a lot.

  • 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-15T09:37:33+00:00Added an answer on June 15, 2026 at 9:37 am

    There is no particular problem with using C++ classes in CUDA. The object model is only slightly different to standard C++.

    Any structure or class data members are automatically defined in whichever memory space (so host or device) the class or structure is instantiated in. What is not automatic is the code generation for function members and operators within classes and structure. The programmer must explicitly define and compile those for whichever memory space the object will be instantiated in. This latter requirement means you must have both __device__ and __host__ definitions of each function you call within the object. This includes the constructor and destructor, the latter being the error you show in your question.

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

Sidebar

Related Questions

I'm trying to write some library functions to enhance the basic collections. Most of
I am trying to enhance my spring-enabled web-app's security using Apache Shiro and am
I'm trying to enhance openJPA classes by this guide: enhancement-with-eclipse.html For some reason the
I am trying to enhance a form, by showing only relevant fields depending on
Trying to make this jQuery filter that uses .find case-insensitive. For example, when the
Trying to prepare good build environment for my js library. According to reviews on
I'm trying to parse a DSN (from a Symfony application) using regular expressions, in
Ok - am trying to create a string library that contains a handful of
I'm trying to enhance Qt's QPrintPreviewWidget by allowing it to display page numbers (in
Hoho there. I was just trying to enhance the performance of my application (.NET

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.