What errors are you getting? We can't help otherwise... are you setting up the project correctly? Have you linked to all the necessary files? Make sure you have checked the basic stuff.
Visual Studio supports ISO C++ Standard. Code::Blocks does not respect this standard. Program written in Code::Blocks can contain parts not compatible with C++ which compiler in Visual Studio is unable to compile.
@ Arnost: Citation Neede. Seriously though I would like to know if that accusation is founded in anything. These types of things are worth keeping track of.
@ OP: Does VS still throw a fit if you forget to include that (approximate name) "stdafx.h" file?
As far as I know, @Arnost is talking about how GCC (being the default compiler for Code::Blocks) allows by default a number of extensions that were developed (in my opinion) because some people were lazy, such as variable length arrays on the stack in the form int a = someFunc(); int array[a];, and so on. However, GCC does fully conform to the standard (apart from some threading stuff, AFAIK), as long as you remember to explicitly specify that you are programming according to the standard (e.g, specify -std=c++11).
If you do turn this on, then from my experience you get problems the other way round, due to Visual Studio entire lack of C99 support and the various extensions that Visual Studio also supports by default (void main being the most common).