# Changing architecture on code blocks

**URL:** <https://forums.developer.nvidia.com/t/changing-architecture-on-code-blocks/26798>\
**Category:** CUDA Programming and Performance\
**Created:** [June 1, 2012, 2:41pm UTC](https://forums.developer.nvidia.com/t/changing-architecture-on-code-blocks/26798 "2012-06-01T14:41:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![S\_HS](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@S\_HS](https://forums.developer.nvidia.com/u/S_HS)\
**Post date:** [June 1, 2012, 2:41pm UTC](https://forums.developer.nvidia.com/t/changing-architecture-on-code-blocks/26798/1 "2012-06-01T14:41:15Z")

</div>

Hi!

I’m using code blocks for developing my code and I need to use atomicAdds in my program. I don’t know how to set the architecture to the one that I’m currently using on my GPU. I know the flag is -arch=sm\_20 but I don’t know in which part of my project’s properties I have to set it. That’s why I get the following error:

```auto
error: identifier "atomicAdd" is undefined|

```

If someone can guide me I’ll really appreciate it [External Image](http://forums.nvidia.com/public/style_emoticons/<#EMO_DIR#>/smile.gif "Image hosted on another site. Click to open in a new tab.")

---

<div class="post-metadata">

**Author:** ![pasoleatis](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@pasoleatis](https://forums.developer.nvidia.com/u/pasoleatis)\
**Post date:** [June 3, 2012, 5:10pm UTC](https://forums.developer.nvidia.com/t/changing-architecture-on-code-blocks/26798/2 "2012-06-03T17:10:43Z")

</div>

When you compile a program on linux you just write in the prompt: nvcc -arch=sm\_20 code.cu and it will compile your code.

---

<div class="post-metadata">

**Author:** ![clhsieh](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/clhsieh/32/443643_2.png) [@clhsieh](https://forums.developer.nvidia.com/u/clhsieh)\
**Post date:** [June 4, 2012, 8:13am UTC](https://forums.developer.nvidia.com/t/changing-architecture-on-code-blocks/26798/3 "2012-06-04T08:13:18Z")

</div>

> [@](#):
>
> Hi!
> 
> I’m using code blocks for developing my code and I need to use atomicAdds in my program. I don’t know how to set the architecture to the one that I’m currently using on my GPU. I know the flag is -arch=sm\_20 but I don’t know in which part of my project’s properties I have to set it. That’s why I get the following error:
> 
> ```auto
> error: identifier "atomicAdd" is undefined|
> 
> ```
> 
> If someone can guide me I’ll really appreciate it [External Image](http://forums.nvidia.com/public/style_emoticons/<#EMO_DIR#>/smile.gif "Image hosted on another site. Click to open in a new tab.")

There seems no project property can use, so I just modify the compiler setting.

I follow this blog to create CUDA NVCC Compiler

Setting-\>Compiler and Debugger-\>CUDA NVCC Compiler-\>Other Settings-\>Advanced options-\>Compile single file to object file

Command line macro:

$compiler --compiler-options “$options” $includes -c $file -o $object -arch=sm\_20

---

<div class="post-metadata">

**Author:** ![S\_HS](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@S\_HS](https://forums.developer.nvidia.com/u/S_HS)\
**Post date:** [June 4, 2012, 9:01am UTC](https://forums.developer.nvidia.com/t/changing-architecture-on-code-blocks/26798/4 "2012-06-04T09:01:03Z")

</div>

> [@](#):
>
> There seems no project property can use, so I just modify the compiler setting.
> 
> I follow this blog to create CUDA NVCC Compiler
> 
> Setting-\>Compiler and Debugger-\>CUDA NVCC Compiler-\>Other Settings-\>Advanced options-\>Compile single file to object file
> 
> Command line macro:
> 
> $compiler --compiler-options “$options” $includes -c $file -o $object -arch=sm\_20

Thanks a lot! it works! [External Image](http://forums.nvidia.com/public/style_emoticons/<#EMO_DIR#>/thanks.gif "Image hosted on another site. Click to open in a new tab.")
