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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:57:54+00:00 2026-05-25T20:57:54+00:00

I am currently writing a CUDA application and want to use the boost::program_options library

  • 0

I am currently writing a CUDA application and want to use the boost::program_options library to get the required parameters and user input.

The trouble I am having is that NVCC cannot handle compiling the boost file any.hpp giving errors such as

1>C:\boost_1_47_0\boost/any.hpp(68): error C3857: 'boost::any': multiple template parameter lists are not allowed

I searched online and found it is because NVCC cannot handle the certain constructs used in the boost code but that NVCC should delegate compilation of host code to the C++ compiler. In my case I am using Visual Studio 2010 so host code should be passed to cl.

Since NVCC seemed to be getting confused I even wrote a simple wrapper around the boost stuff and stuck it in a separate .cpp (instead of .cu) file but I am still getting build errors. Weirdly the error is thrown upon compiling my main.cu instead of the wrapper.cpp but still is caused by boost even though main.cu doesn’t include any boost code.

Does anybody know of a solution or even workaround for this problem?

  • 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-25T20:57:55+00:00Added an answer on May 25, 2026 at 8:57 pm

    Dan, I have written a CUDA code using boost::program_options in the past, and looked back to it to see how I dealt with your problem. There are certainly some quirks in the nvcc compile chain. I believe you can generally deal with this if you’ve decomposed your classes appropriately, and realize that often NVCC can’t handle C++ code/headers, but your C++ compiler can handle the CUDA-related headers just fine.

    I essentially have main.cpp which includes my program_options header, and the parsing stuff dictating what to do with the options. The program_options header then includes the CUDA-related headers/class prototypes. The important part (as I think you’ve seen) is to just not have the CUDA code and accompanying headers include that options header. Pass your objects to an options function and have that fill in relevant info. Something like an ugly version of a Strategy Pattern. Concatenated:

    main.cpp:
    #include "myprogramoptionsparser.hpp"
    (...)
    CudaObject* MyCudaObj = new CudaObject;
    GetCommandLineOptions(argc,argv,MyCudaObj);
    
    myprogramoptionsparser.hpp:
    #include <boost/program_options.hpp>
    #include "CudaObject.hpp"
    
    void GetCommandLineOptions(int argc,char **argv,CudaObject* obj){
    (do stuff to cuda object) }
    
    CudaObject.hpp:
    (do not include myprogramoptionsparser.hpp)
    
    CudaObject.cu:
    #include "CudaObject.hpp"
    

    It can be a bit annoying, but the nvcc compiler seems to be getting better at handling more C++ code. This has worked fine for me in VC2008/2010, and linux/g++.

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

Sidebar

Related Questions

I'm writing my own graphics library (yep, its homework:) and use cuda to do
Im currently writing my bachelor thesis with latex and using TexnicCenter. I want to
im currently writing an error_logger handler and would like to get the stacktrace where
I'm currently writing an application which uses ajax on the front end and ASP.NET
I'm currently writing an application that will control positioning of a measurement device. Because
I'm currently writing an application that I would like to open in a new
Our company is currently writing a GUI automation testing tool for compact framework applications.
I am currently writing a simple, timer-based mini app in C# that performs an
I am currently writing a small calendar in ASP.Net C#. Currently to produce the
I'm currently writing an ASP.Net app from the UI down. I'm implementing an MVP

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.