how to install and open devcpp projects in codeblocks

here at eyebeam, we’ve been experimenting with using codeblocks as an alternative to devcpp. big props to friedrich for getting us going. it’s based on the same compiler (mingw) but as an IDE has some obvious benifits:

a) active community
b) significantly less buggy
c) just had a new release

we will release 0.05 w/ codeblocks as opposed to devcpp, since devcpp has serious limitations

here’s a step by step tutorial to get up and running, and inport your devcpp projects in codeblocks.

click the images to see big ones

a) download code::blocks binary (latest release)

http://www.codeblocks.org/downloads/5

note: download WITH mingw.

**b) install **

c) setup

you don’t have to change anything

d) associate c++ files?

I chose not too, since code::blocks is not my primary IDE

e) add files to mingw

similar to devcpp, we will have to add a few libraries to devcpp. you can download the files : here.
in the zip there are two folders, you need to put the contents of them into the contents of folders in mingw.

– add the contents of the folder “add_to_codeblocks_mingw_include” into “C:\Program Files\CodeBlocks\MinGW\include”
(or wherever your app\mingw\include is)

– add the contents of the folder “add_to_codeblocks_mingw_lib” into “C:\Program Files\CodeBlocks\MinGW\lib”
(or wherever your app\mingw\lib is)

f) import your devcpp project

file → import

g) choose compiler (mingw / gnu gcc)

just choose the top one:

h) the default sorting looks terrible

this is an example of the default sorting, which separates cpp and h files:

i) we suggest to change it to this

if you unclick “categorize by file types” things look like normal.

j) need to do one more thing to compile

if we compile now, we get link errors. right click target and say “go to build options”

k) get to the linker settings

navigate to the linker settings. make sure you are not highlighting “default” in the top left. highlight the name of the target.

l) change the lower links to "-l"

before

after

m) now we can compile!!

hope that’s helpful for anyone looking for a devcpp alternative —
please let me know if that works, or you have issues, etc.

take care!!
zach

thank you for the tips, i just tried it,everything seems working fine,but when i hit the “run” button within the codeblock,it gave me the error message in the console.

however if i’m going to dictionary where the “fontsExample” is,the Executable file just working good as normal.

am i missing something,or took the wrong step?
btw, the example i’m using is from the 0.04.


[/img]

oh snaps, I missed one step :oops: thanks for the feedback

(step k-2…)

under project (menu) -> options -> build targets -> execution working direcctory

change it to say “bin” (I think it will say “.”)

this changes the “current working directory” that the compiler is running from… thus, looking for data folder will work.

(the same problem occurs in eclipse and VS too)

hope that helps – I’ll make an image for it in a sec.

take care - zach

I get the error “cannot find -lstrmbase”
Also “cannot find -lz”

I did copy the required files to the lib folder in the mingw folder.

in your libs folder do you have:
“C:\Program Files\CodeBlocks\MinGW\lib\libSTRMBASE.a”
?

when you copy, be sure to read the directions (copy the **contents **of one folder into the **contents **of the other folder)

it it with every example, or just video grabbing ones – I’ll check too
(I don’t know if I’ve checked all examples) – _just checked, works for me
_

I’d make sure you have put the libs in the right place and that you have done the adding “-l” step described above.

take care
zach

Hi Zach,

libSTRMBASE.a is directly in my “C:\Program Files\CodeBlocks\MinGW\lib” folder, not in a subfolder.

I’m testing with the ‘emptyExample’ of of0.05_devcpp

have no idea – for me it’s worked fine on several machines

can you :

a) upload a zip of your project (including the .cbp file)
b) make sure that you got the libs in your lib folder, ie do you have these file:

C:\Program Files\CodeBlocks\MinGW\lib\libz.a
C:\Program Files\CodeBlocks\MinGW\lib\libSTRMBASE.a

c) make sure that you did the “-l” step for the libs above and that it looks like the “after” image

thanks!
zach

Hi Zach,

I think I found something. There was another MinGW folder somewhere on my system. And somehow CodeBlocks was using that one instead of the one within the CodeBlocks folder.

I deleted the one located at C:\MinGW and that solved the problem. I don’t know why CodeBlocks used that version. It wasn’t in the environment PATH. But deleting it helped.

Rick

ah – interesting !! that’s explains alot.

If you can, do you think you can you let us know how you noticed that (a screenshot or something) so that others don’t get tripped up… if you can’t no worries, but if there is a panel that identifies that, would be useful to know.

thanks!
zach

i’m glad, :smiley: ,working now! thxs for the help!

I was getting a compile error because a bug in MinGW. I found the solution here:

http://forums.codeblocks.org/index.php?-…-;topicseen

Basically you need to download and override:

gcc-core
gcc-g++

After that, it compiles correctly.

Cheers, chr

well, finally i already istalled Code Blocks due to the problem that i had with Devc++ , i followed all the steps to install it and to import a project, copying the folder contents inside of the right place, etc… im having this issue now, have a look…

i start since when i import the project:

as you can see i can not see the project files using Dev C++ files

But if i use all files i got this:

Then when i import the polygonExample file i got this

I dont see the GNU GCC Compiler “detected”… even other one…

after that Codeblocks ask me this:

I just click ok and the porject appears like that:

Then i click right the name of the project to see the build options , i get this:

if i click on debugwin32 or releasewin32 i see the link libraries, but i never see on the side other linker options:

this is a link for the codeblock download on the download page – I don’t think you want to import a visual studio project, since the compiler for CB, mingw/gcc, can’t use visual studio libraries (which is what you are getting when you import VS files).

just download the windows codeblocks package and you should be good to go :slight_smile:

take care!
zach

i forgot to tell you that at the end , i click on build to compile the project, it runs, and runs, and finally i get this result:

If some one know the reason , i miss something in one step at the moment to install the program or copying the files, or putting the files project in the right place, i really dont know, thanks if you see my “sos” message, im not an expert in open frameworks, but i already uninstal Dev c++ due to the problem that it has in the last version, now im trying codeblocks and i really want to start with open frameworks, thanks for your time guys, see you…

codeblock won’t compile and imported visual studio project – that’s why you see link errors – just download the codeblocks package on the download page:

http://www.openframeworks.cc/versions/p-…-n32-cb.zip

have fun !
zach

I see now, as you say the compiler of CB dont read visual projects, im gonna download again from this part

pre release v0.06

windows: visual studio 2008 | visual studio 2008 FAT
code blocks | code blocks FAT

Im i Right?

and a try that with codeblocks, im gonna put it direct in c: to use it and im still trying, never loosing faith!!! Thanks again…

yep, that’s the one –

happy to walk you through any remaining issues ! :slight_smile:

take care,
zach

Hi, I stopped after step i and it seems to have compiled just fine. Might want to cut out the remaining bits, or at least add a note that they’re likely to be necessary?

Incidentally the Download-page still says 'If you are beginning, on windows we suggest dev-c++, ’ which I take it is not true any more…?