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

The Archive Base Latest Questions

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

While compiling this hello world sample in Ubuntu 10.10 This is from CUDA by

  • 0

While compiling this hello world sample in Ubuntu 10.10

This is from CUDA by Example, chapter 3 (No compile instructions provided >:@)

#include <iostream>

__global__ void kernel (void){


}

int main(void){

    kernel <<<1,1>>>();
        printf("Hellow World!\n");
    return 0;

}

I got this:

$ nvcc -lcudart hello.cu hello.cu(11): error: identifier “printf” is
undefined

1 error detected in the compilation of
“/tmp/tmpxft_00007812_00000000-4_hello.cpp1.ii”.

Why? How should this code be compiled?

  • 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-25T06:43:27+00:00Added an answer on May 25, 2026 at 6:43 am

    You need to include stdio.h or cstdionot iostream (which is for std::cout stuff) for printf (see man 3 printf). I found the source code for the book here.

    chapter03/hello_world.cu is actually:

    
    /*
     * Copyright 1993-2010 NVIDIA Corporation.  All rights reserved.
     *
     * NVIDIA Corporation and its licensors retain all intellectual property and 
     * proprietary rights in and to this software and related documentation. 
     * Any use, reproduction, disclosure, or distribution of this software 
     * and related documentation without an express license agreement from
     * NVIDIA Corporation is strictly prohibited.
     *
     * Please refer to the applicable NVIDIA end user license agreement (EULA) 
     * associated with this source code for terms and conditions that govern 
     * your use of this NVIDIA software.
     * 
     */
    
    
    #include "../common/book.h"
    
    int main( void ) {
        printf( "Hello, World!\n" );
        return 0;
    }
    
    

    Where ../common/book.h includes stdio.h.

    The README.txt file details how to compile the examples:

    
    The vast majority of these code examples can be compiled quite easily by using 
    NVIDIA's CUDA compiler driver, nvcc. To compile a typical example, say 
    "example.cu," you will simply need to execute:
    
    > nvcc example.cu
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make work this example from http://developer.android.com/resources/tutorials/views/hello-timepicker.html , no errors while compiling
While compiling a demo from openni i stumbled across this error: Exception in thread
While compiling a program in Java I got this big WARNING warning: [unchecked] unchecked
I am getting the following error while compiling a sample program in Qt 4.5
I have this very strange problem while compiling the project. MOC seems to be
I am receiving this error while compiling a C program in MinGW. As far
How can I get rid of this error and other while compiling the below
I get this error android.database.sqlite.SQLiteException: near %: syntax error: , while compiling: SELECT _id,
I've been compiling simple Hello World applications in Visual Studio 2010 with the C++
I have a compiling problem. I followed tutorial about Hello world program for Android

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.