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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:37:27+00:00 2026-05-26T21:37:27+00:00

I have a visual studio c++ project (with VS 2010 and insight 2) which

  • 0

I have a visual studio c++ project (with VS 2010 and insight 2) which contains a cuda file. Here’s the code

Hello.h :

#pragma once

#pragma warning(push)
#pragma warning(disable:4996)
#include "thrust\device_vector.h"
#pragma warning(pop)

class Hello
{
public:
    Hello( const thrust::host_vector<unsigned long>& data );
    unsigned long Sum();
    unsigned long Max();

private:
    thrust::device_vector<unsigned long> m_data;
}

Hello.cu :

#include "thrust\host_vector.h"
#include "thrust\device_vector.h"
#include "thrust\extrema.h"

#include "Hello.h"

using namespace ::thrust;

Hello::Hello( const thrust::host_vector<unsigned long>& data )
    : m_data( data.cbegin(), data.cend() )
{
}

unsigned long
Hello::Sum()
{
    return( reduce( m_data.cbegin(), m_data.cend(), 
        ( unsigned long )0,
        plus<unsigned long>() ) );
}

unsigned long
Hello::Max()
{
    return( *max_element( m_data.cbegin(), m_data.cend() ) );
}

and finally main.cpp :

#ifdef _WIN32
    #define WINDOWS _LEAN_AND_MEAN
    #define NOMINMAX
    #include <Windows.h>
#endif

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <ppl.h> //parallel patterns library

#include "Hello.h"

using namespace ::Concurrency;

int
main( int argc, char** argv )
{
    printf( "Generating data...\n" );
    thrust::host_vector<unsigned long> host_data( 100000 );
    thrust::generate( host_data.begin(), host_data.end(), rand );
    printf( "generated %d numbers\n", host_data.size() );

    parallel_invoke(
        [host_data]()
    {
        printf( "\nRunning host code...\n" );
        unsigned long host_result = thrust::reduce( host_data.cbegin(),
            host_data.cend(), 0, thrust::plus<unsigned long>() );
        printf( "The sum is %d\n", host_result );

        host_result = *thrust::max_element( host_data.cbegin(), 
            host_data.cend(), thrust::less<unsigned long>() );
        printf( "The max is %d\n", host_result );
    },
        [host_data]()
    {
        printf( "\nCopying data to device...\n" );
        Hello hello( host_data );

        printf( "\nRunning CUDA device code...\n" );
        unsigned long device_result = hello.Sum();
        printf( "The sum is %d\n", device_result );

        printf( "\nRunning CUDA device code...\n" );
        device_result = hello.Max();
        printf( "The max is %d\n", device_result );
    }
    );

    return( 0 );
}

This code comes from : here

My problem is that when I build the project, it gives me this error:

Hello.cu(5): fatal error C1083: Cannot open include file: 'Hello.h': No such file or  directory

However, when I right click on the “include “Hello.h”” it finds the file just fine.

I’ve added the folder where my .h are in the additionnal include directories of the project. So I really don’t know why it couldn’t open the file.

I don’t know if it’s more of a configuration problem of just maybe a c++ thing I forgot…

  • 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-26T21:37:28+00:00Added an answer on May 26, 2026 at 9:37 pm

    Your .cu file will have most likely have a custom build rule to make use of NVCC. Right-click the .cu file and look at its properties. The build rule will again contain a section for additional include directories. Make sure the directory containing your header is present there as well.

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

Sidebar

Related Questions

I have a visual studio-2010 project which contains lots of source files and header
In my Visual Studio 2010 project I have files with .mm file extension, that
I have a WCF visual studio project, which contains many SVC files. Can I
I have a Visual Studio 2010 Database project, from which I want to generate
I have a Visual Studio 2010 C++ project which was copied from another visual
I have a Visual Studio 2010 project with C++ code that I want to
Has anyone migrated a VB6 project to .Net with Visual Studio 2010? I have
Hi I have a visual studio project which includes postbuildevents in the following form:
I have a Visual Studio Setup project which has a Application Folder DefaultLocation set
I have a visual studio 2010 project. It runs from my notebook fine but

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.