首页 \ 问答 \ CUDA:编译我的第一个cuda程序时出错(CUDA: Error while compiling my first cuda program)

CUDA:编译我的第一个cuda程序时出错(CUDA: Error while compiling my first cuda program)

我是CUDA编程的新手。我编写了我的第一个代码,当我编译它时,它向我显示了很多错误。 任何人都可以告诉我有什么问题

代码

#include <stdio.h>
#include "cuda.h"
#include <stdlib.h>

__global__ void kernel(void) {
}

int main(int argc, char *argv[])
{
        kernel<<<1,1>>>();
        printf("finished \n");
        return 0;
}

错误是

cuda.c:5: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before âvoidâ
cuda.c:7: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before âvoidâ
cuda.c: In function âmainâ:
cuda.c:12: error: âkernelâ undeclared (first use in this function)
cuda.c:12: error: (Each undeclared identifier is reported only once
cuda.c:12: error: for each function it appears in.)
cuda.c:12: error: expected expression before â<â token

我编译使用

nvcc cuda.c

谁能告诉我我犯的是什么错误....


I am very new to CUDA programming.. I wrote my first code and when I compiled it, it is showing me a lots of error. Can anyone tell me what is wrong

the code

#include <stdio.h>
#include "cuda.h"
#include <stdlib.h>

__global__ void kernel(void) {
}

int main(int argc, char *argv[])
{
        kernel<<<1,1>>>();
        printf("finished \n");
        return 0;
}

The errors are

cuda.c:5: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before âvoidâ
cuda.c:7: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before âvoidâ
cuda.c: In function âmainâ:
cuda.c:12: error: âkernelâ undeclared (first use in this function)
cuda.c:12: error: (Each undeclared identifier is reported only once
cuda.c:12: error: for each function it appears in.)
cuda.c:12: error: expected expression before â<â token

I compiled using

nvcc cuda.c

Can anyone tell me what mistake I am making....


原文:https://stackoverflow.com/questions/4362455
更新时间:2022-09-12 20:09

最满意答案

使用MergeArea

Sub showRandomWord()
Dim ws As Worksheet, ws2 As Worksheet
Dim stRow As Long, endRow As Long, dataCol As Long
Dim dispRow As Long, dispCol As Long

Set ws = Sheets("Sheet1")
Set ws2 = Sheets("Sheet2")
stRow = 2
dataCol = 1
dispRow = 2
dispCol = 2

With ws
    endRow = .Cells(.Rows.Count, dataCol).End(xlUp).Row
End With

ws2.Cells(dispRow, dispCol).Value = ""
ws.Cells(Application.RandBetween(stRow, endRow), dataCol).Value

ws2.Range("J2").MergeArea.ClearContents

End Sub

Use MergeArea?

Sub showRandomWord()
Dim ws As Worksheet, ws2 As Worksheet
Dim stRow As Long, endRow As Long, dataCol As Long
Dim dispRow As Long, dispCol As Long

Set ws = Sheets("Sheet1")
Set ws2 = Sheets("Sheet2")
stRow = 2
dataCol = 1
dispRow = 2
dispCol = 2

With ws
    endRow = .Cells(.Rows.Count, dataCol).End(xlUp).Row
End With

ws2.Cells(dispRow, dispCol).Value = ""
ws.Cells(Application.RandBetween(stRow, endRow), dataCol).Value

ws2.Range("J2").MergeArea.ClearContents

End Sub

相关问答

更多
  • 您正在寻找一个Calculate选项而不是RefreshAll选项 我建议你使用Application.CalculateFull来计算所有公式 Charles Williams对Excel计算方法的这一链接可能证明是有用的 Rather than a RefreshAll option you are looking for a Calculate option I suggest you use Application.CalculateFull to calculate all formulae Th ...
  • 使用MergeArea ? Sub showRandomWord() Dim ws As Worksheet, ws2 As Worksheet Dim stRow As Long, endRow As Long, dataCol As Long Dim dispRow As Long, dispCol As Long Set ws = Sheets("Sheet1") Set ws2 = Sheets("Sheet2") stRow = 2 dataCol = 1 dispRow = 2 dispCol ...
  • 改变这个: month = Worksheet(2).Cells(31, "J") 对此: month = Worksheet(2).Cells(31, "J").Value 和这个: Sheet1.Range("C" & num & ":C18") = 34 对此: For Each c in Worksheet(1).Range("C" & num & ":C18") c.Value = 34 Next c Change this: month = Worksheet(2).Cells(31 ...
  • 这对我有效... Sub Tester() Dim c As Range, cTot As Range, s As Series 'collect all values for "40" For Each c In Range("D1:D27").Cells If c.Offset(0, -1) = 40 Then If cTot Is Nothing Then Set cTot = c ...
  • 尝试: PROGGRAPH.Range("A5", "A93") Try: PROGGRAPH.Range("A5", "A93")
  • 原因很简单,当您从CSV复制然后在工作簿中复制时,单击开发人员工具栏中的Macros ,Excel将清除剪贴板。 当您单击Developer | Macros时,Excel有清除剪贴板的习惯 Developer | Macros 。 为了演示这一点,请从同一工作簿中复制单元格。 你会看到蚂蚁像细胞周围的边界。 现在在同一个工作簿中,单击Developer | 宏。 像边框一样的Ant会消失:) 设置宏的快捷键并使用它。 它会工作:) The reason is very simple, When you c ...
  • 你的最后一行, Debug.Print wksPivotData.Range(1, 1).Value将不会打印,因为你错过了Range() 。 我想你想要A1? 使用Range(1,1) ,您指的是不存在的范围。 如果你想做单元格A1,你需要 With wksPivotData myData = .Range(.Cells(1,1),.Cells(1,1)).Value End with 由于您使用的是多个工作表,因此我将使用上面的with语句。 编写相同内容的另一种方法是wksPivotData. ...
  • 您的copyPath只是一个文件夹,但SaveCopyAs的参数应该是带文件名的完整路径。 试试这个: ThisWorkbook.SaveCopyAs copyPath & "\filename.xlsx" Your copyPath is only a folder, but the argument of SaveCopyAs should be a full path with file name. Try this: ThisWorkbook.SaveCopyAs copyPath & "\file ...
  • 问题是当变量表示为字符串时,它将具有系统的小数点。 在你的情况下它是一个逗号,所以你需要将它转换为点,例如使用replace()函数。 The problem is when a variable is represented as string it will have the system's decimal point. In your case it is a comma so you need to convert it to dot, for example using replace() fu ...
  • 您要求vLookup返回2列范围,而不是1列范围。 更改BRange =“A2:B9”以使您的vLookup获取标准普尔价值。 或者,您可以将范围更改为A2:C9,并在vLookup中将2更改为3并获得DJ平均值。 简而言之,vLookup只能将列引用返回到范围中的最大列数。 它可以返回3列范围内的第1,第2,第3列参考,但不能返回第4列,因为没有第4列。 You are asking vLookup to return on a 2 column range, against a 1 column ran ...

相关文章

更多

最新问答

更多
  • h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
  • 创建一个功能(Create a function)
  • 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
  • PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
  • Qt冻结循环的原因?(Qt freezing cause of the loop?)
  • TableView重复youtube-api结果(TableView Repeating youtube-api result)
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
  • 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
  • 以编程方式创建UITableView(Creating a UITableView Programmatically)
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
  • Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
  • 设置kotlin扩展名(Setting a kotlin extension)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 如何在vim中启用python3?(How to enable python3 in vim?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • dedecms如何安装?
  • 在哪儿学计算机最好?
  • 学php哪个的书 最好,本人菜鸟
  • 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
  • 如何覆盖错误堆栈getter(How to override Error stack getter)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
  • 电脑高中毕业学习去哪里培训
  • 正则表达式验证SMTP响应(Regex to validate SMTP Responses)