Code::blocks


#1

I’ve just been trying to add a code::blocks project, but can’t get the damn thing to compile, probably because of my mingw setup…
I’ve just checked in the new projects, so maybe some of you guys who’ve already been using codeblocks could have a look and see if they work for you? Ta!


#2

Hi Julian!

Thank God, you make the CodeBlocks project for JUCE.

By the way, I always import the DEV-C++ project into CodeBlocks and compile it without any problems. Probably you’re right, the problem is your mingw (not CodeBlocks).

I could see what’s the problem but sourceforge seems to be down for maintenance. Have to wait for awhile.


#3

CONGRATULATIONS Julian! :slight_smile:

Your new CodeBlocks project (that from SVN) just has been perfectly compiled under Windows.

Can you provide the CodeBlocks project for Linux too? (it’s just the matter of replacing all platform specific stuff for appropriate Linux one).

Many thanks again!


#4

Well that’s good to know! I’ve no idea what I’ve done wrong here, but my mingw setup seems to just be a mess. I’ll keep messing with it.

BTW, would anyone object if I ditch the old dev-cpp project? I don’t want to have too many platforms to support.


#5

Well, I dare to say, go ahead! Ditch that bitch :lol:

A little advice on mingw. If CodeBlocks complains about it cannot run the compiler (cannot find it) than check the compiler settings in the Codeblocks IDE and provide appropriate paths for GNU GCC compiler (mingw) [Settings->Compiler and debuger settings->Toolchain executables / Search directories]. Moreover, add all the paths for mingw’s bin, lib and include(optionally) directories to the system PATH environment variable . It might help.


#6

I would also say ditch dev-cpp it seems to be dead, the last update is a long timeago.


#7

So, does anyone know how to get a Code::Blocks setup working? (either with mingw or VC++e’s compiler). I’ve managed to build juce (with trouble) with both, but i can’t get the juce demo to build. i can’t change the linker command line properly for the vc++ compiler - it keeps putting ‘-l’ directly before the library names, and i can’t get rid of it. i imagine there’s more than just that tho!


#8

uhm…ok, my cpp skills are really poor, but last year a spend some time “playing” with juce and having fun…ok, who cares. the issue: codeblocks…i open the build project from juce and i get that

[quote]
12:07:24: The path ‘C:JUCE changelist.txt’ contains too many “…”!
12:07:24: The path ‘C:juce.h’ contains too many “…”!
12:07:24: The path ‘C:juce_Config.h’ contains too many “…”!
12:07:24: The path ‘C:juce_DefineMacros.h’ contains too many “…”!
12:07:25: The path ‘C:juce_WithoutMacros.h’ contains too many “…”!
12:07:25: The path ‘C:juce_app_includes.h’ contains too many “…”!
12:07:25: The path ‘C:juce_Application.cpp’ contains too many “…”!
12:07:25: The path ‘C:juce_Application.h’ contains too many “…”!
12:07:25: The path ‘C:juce_ApplicationCommandID.h’ contains too many “…”!
12:07:25: The path ‘C:juce_ApplicationCommandInfo.cpp’ contains too many “…”!
12:07:25: The path ‘C:juce_ApplicationCommandInfo.h’ contains too many “…”!
12:07:25: The path ‘C:juce_ApplicationCommandManager.cpp’ contains too many “…”!
12:07:25: The path ‘C:juce_ApplicationCommandManager.h’ contains too many “…”!
12:07:25: The path ‘C:juce_ApplicationCommandTarget.cpp’ contains too many “…”!
12:07:25: The path ‘C:juce_ApplicationCommandTarget.h’ contains too many “…”!
12:07:25: The path ‘C:juce_ApplicationProperties.cpp’ contains too many “…”!
12:07:25: The path ‘C:juce_ApplicationProperties.h’ contains too many “…”!
12:07:25: The path ‘C:juce_DeletedAtShutdown.cpp’ contains too many “…”!
12:07:25: The path ‘C:juce_DeletedAtShutdown.h’ contains too many “…”!
12:07:25: The path ‘C:juce_PropertiesFile.cpp’ contains too many “…”!
12:07:25: The path ‘C:juce_PropertiesFile.h’ contains too many “…”!
12:07:25: The path ‘C:juce_SystemClipboard.h’ contains too many “…”!
12:07:25: The path ‘C:all.h’ contains too many “…”!
12:07:25: The path ‘C:assert.h’ contains too many “…”!
12:07:25: The path ‘C:callback.h’ contains too many “…”!
12:07:25: The path ‘C:export.h’ contains too many “…”!

12:07:27: The path ‘C:juce_BorderSize.cpp’ contains too many “…”!
12:07:27: The path ‘C:juce_BorderSize.h’ contains too many “…”!
12:07:27: The path ‘C:juce_Line.cpp’ contains too many “…”!
12:07:27: The path ‘C:juce_Line.h’ contains too many “…”!
12:07:27: The path ‘C:juce_Path.cpp’ contains too many “…”!
12:07:27: The path ‘C:juce_Path.h’ contains too many “…”!
12:07:27: The path ‘C:juce_PathIterator.cpp’ contains too many “…”!
12:07:27: The path ‘C:juce_PathIterator.h’ contains too many “…”!
12:07:27: The path ‘C:juce_PathStrokeType.cpp’ contains too many “…”!
12:07:27: The path ‘C:juce_PathStrokeType.h’ contains too many “…”!
12:07:27: The path ‘C:juce_Point.cpp’ contains too many “…”!
12:07:28: The path ‘C:juce_Point.h’ contains too many “…”!
12:07:28: The path ‘C:juce_PositionedRectangle.cpp’ contains too many “…”!
12:07:28: The path ‘C:juce_PositionedRectangle.h’ contains too many “…”!
12:07:28: The path ‘C:juce_Rectangle.cpp’ contains too many “…”!
12:07:28: The path ‘C:juce_Rectangle.h’ contains too many “…”!
12:07:28: The path ‘C:juce_RectangleList.cpp’ contains too many “…”!
12:07:28: The path ‘C:juce_RectangleList.h’ contains too many “…”!
12:07:28: The path ‘C:cderror.h’ contains too many “…”!
12:07:28: The path ‘C:jcapimin.c’ contains too many “…”!
12:07:28: The path ‘C:jcapistd.c’ contains too many “…”!
12:07:28: The path ‘C:jccoefct.c’ contains too many “…”!
12:07:28: The path ‘C:jccolor.c’ contains too many “…”!
12:07:28: The path ‘C:jcdctmgr.c’ contains too many “…”!
12:07:28: The path ‘C:jchuff.c’ contains too many “…”!
[/quote] this is just a few lines of the list i get

and then if i try to build juce i get that a looooot of errors or missing files.
where am i wrong?
i’m using mingw right now

thanks a lot


#9

Maybe get the lastest Mingw. Earlier ones seemed to have daft restrictions on path lengths.


#10

yesss!!! and nooooo :shock:
i’ve been able to build both libjuce.a and libjucedebug.a but i can’t build the demo. it compiles all the sources but when it goes to linking …it’s just a mess :slight_smile:

Compiling: ..\..\src\demos\ThreadingDemo.cpp
Compiling: ..\..\src\demos\TreeViewDemo.cpp
Compiling: ..\..\src\demos\WidgetsDemo.cpp
Linking executable: build\JuceDemo.exe
C:\Programmi\CodeBlocks\lib/libstdc++.a(eh_personality.o):eh_personality.cc:(.rdata$_ZTISt9exception[__ZTISt9exception]+0x0): multiple definition of `typeinfo for std::exception'
..\..\..\..\bin\codeblocks/libjucedebug.a(juce_Application.o):juce_Application.cpp:(.data$_ZTISt9exception[__ZTISt9exception]+0x0): first defined here
C:\Programmi\CodeBlocks\lib/libstdc++.a(eh_personality.o):eh_personality.cc:(.rdata$_ZTSSt9exception[__ZTSSt9exception]+0x0): multiple definition of `typeinfo name for std::exception'
..\..\..\..\bin\codeblocks/libjucedebug.a(juce_Application.o):juce_Application.cpp:(.text$_ZTSSt9exception[__ZTSSt9exception]+0x0): first defined here
..\..\..\..\bin\codeblocks/libjucedebug.a(juce_win32_Network.o):juce_win32_Network.cpp:(.text+0x17): undefined reference to `InternetGetConnectedState@8'
..\..\..\..\bin\codeblocks/libjucedebug.a(juce_win32_Network.o):juce_win32_Network.cpp:(.text+0x102): undefined reference to `InternetOpenA@20'
..\..\..\..\bin\codeblocks/libjucedebug.a

[......long long long list!!!]

(juce_win32_Midi.o):juce_win32_Midi.cpp:(.text$_ZN4juce12MidiInThread4stopEv[__ZN4juce12MidiInThread4stopEv]+0xe2): undefined reference to `midiInUnprepareHeader@12'
..\..\..\..\bin\codeblocks/libjucedebug.a(juce_win32_Midi.o):juce_win32_Midi.cpp:(.text$_ZN4juce12MidiInThreadD1Ev[__ZN4juce12MidiInThreadD1Ev]+0x44): undefined reference to `midiInClose@4'
..\..\..\..\bin\codeblocks/libjucedebug.a(juce_win32_Midi.o):juce_win32_Midi.cpp:(.text$_ZN4juce12MidiInThreadD0Ev[__ZN4juce12MidiInThreadD0Ev]+0x44): undefined reference to `midiInClose@4'
..\..\..\..\bin\codeblocks/libjucedebug.a(juce_win32_Midi.o):juce_win32_Midi.cpp:(.text$_ZN4juce12MidiInThread10writeBlockEi[__ZN4juce12MidiInThread10writeBlockEi]+0x6d): undefined reference to `midiInPrepareHeader@12'
..\..\..\..\bin\codeblocks/libjucedebug.a(juce_win32_Midi.o):juce_win32_Midi.cpp:(.text$_ZN4juce12MidiInThread10writeBlockEi[__ZN4juce12MidiInThread10writeBlockEi]+0xbe): undefined reference to `midiInAddBuffer@12'
..\..\..\..\bin\codeblocks/libjucedebug.a(juce_win32_Midi.o):juce_win32_Midi.cpp:(.text$_ZN4juce12MidiInThread3runEv[__ZN4juce12MidiInThread3runEv]+0xb5): undefined reference to `midiInUnprepareHeader@12'
..\..\..\..\bin\codeblocks/libjucedebug.a(juce_Socket.o):juce_Socket.cpp:(.text+0xc6): undefined reference to `WSAStartup@8'
..\..\..\..\bin\codeblocks/libjucedebug.a(juce_Socket.o):juce_Socket.cpp:(.text+0x236): undefined reference to `WSAStartup@8'
..\..\..\..\bin\codeblocks/libjucedebug.a(juce_Socket.o):juce_Socket.cpp:(.text+0x541): undefined reference to `WSACleanup@0'
..\..\..\..\bin\codeblocks/libjucedebug.a(juce_Socket.o):juce_Socket.cpp:(.text+0x62b): undefined reference to `WSACleanup@0'
..\..\..\..\bin\codeblocks/libjucedebug.a(juce_Socket.o):juce_Socket.cpp:(.text+0x6d9): undefined reference to `setsockopt@20'
..\..\..\..\bin\codeblocks/libjucedebug.a(juce_Socket.o):juce_Socket.cpp:(.text+0x6ff): undefined reference to `setsockopt@20'
..\..\..\..\bin\codeblocks/libjucedebug.a(juce_Socket.o):juce_Socket.cpp:(.text+0x71f): undefined reference to `setsockopt@20'
..\..\..\..\bin\codeblocks/libjucedebug.a(juce_Socket.o):juce_Socket.cpp:(.text+0x782): undefined reference to `recv@16'
..\..\..\..\bin\codeblocks/libjucedebug.a(juce_Socket.o):juce_Socket.cpp:(.text+0x7ed): undefined reference to `send@16'

[......long long long list!!!]

text+0xcb9): undefined reference to `htons@4'
..\..\..\..\bin\codeblocks/libjucedebug.a(juce_Socket.o):juce_Socket.cpp:(.text+0xcd1): undefined reference to `socket@12'
..\..\..\..\bin\codeblocks/libjucedebug.a(juce_Socket.o):juce_Socket.cpp:(.text+0xd10): undefined reference to `setsockopt@20'
..\..\..\..\bin\codeblocks/libjucedebug.a(juce_Socket.o):juce_Socket.cpp:(.text+0xd28): undefined reference to `bind@12'
..\..\..\..\bin\codeblocks/libjucedebug.a(juce_Socket.o):juce_Socket.cpp:(.text+0xd43): undefined reference to `listen@8'
..\..\..\..\bin\codeblocks/libjucedebug.a(juce_Socket.o):juce_Socket.cpp:(.text+0xe28): undefined reference to `accept@12'
..\..\..\..\bin\codeblocks/libjucedebug.a(juce_Socket.o):juce_Socket.cpp:(.text+0xe76): undefined reference to `inet_ntoa@4'
C:\Programmi\CodeBlocks\lib/libstdc++.a(eh_throw.o):eh_throw.cc:(.text+0xfa): undefined reference to `_Unwind_SjLj_Resume_or_Rethrow'
Process terminated with status 1 (0 minutes, 33 seconds)

i’m really sorry to be such a newbie :oops:


#11

#12

[quote=“debaser”]yesss!!! and nooooo :shock:
i’ve been able to build both libjuce.a and libjucedebug.a but i can’t build the demo. it compiles all the sources but when it goes to linking …it’s just a mess :slight_smile:

juce_win32_Network.cpp:(.text+0x17): undefined reference to `InternetGetConnectedState@8'

[......long long long list!!!]

libjucedebug.a(juce_Socket.o):juce_Socket.cpp:(.text+0x236): undefined reference to `WSAStartup@8'

[......long long long list!!!]

C:\Programmi\CodeBlocks\lib/libstdc++.a(eh_throw.o):eh_throw.cc:(.text+0xfa): undefined reference to `_Unwind_SjLj_Resume_or_Rethrow'
Process terminated with status 1 (0 minutes, 33 seconds)

i’m really sorry to be such a newbie :oops:[/quote]


Hi debaser!

The Code::Blocks IDE is not guilty! :slight_smile:
Telling the truth, the Code::Blocks IDE is not really related to your problems.

Add the following libraries to your project for linking:

[color=blue]libwininet.a
libwinmm.a
libws2_32.a
[/color][color=darkblue] (or libwsock32.a)[/color]

I’ve noticed the error telling you that you have [color=darkred]’ C:\Programmi\CodeBlocks\lib/libstdc++.a(eh_throw.o):eh_throw.cc:(.text+0xfa): undefined reference to `_Unwind_SjLj_Resume_or_Rethrow’ '[/color]. You [color=red]MUST NOT[/color] directly link to the [color=red]libstdc++[/color] library in your project. Moreover, your version of libstdc++ is likely Dwarf2 but your MinGW uses GCC-sjlj. Remove that library from linkage. Never link directly to the GCC system libraries. If your GCC complains of it cannot find libstdc++, just add the MinGW system library path to the PATH environment variable in your system.

I think it may help.


#13

same problem here.

test case:

loaded the project file to build latest juce144 on codeblocks (super updated codeblocks with latest mingw 3.4.4 [downloaded yesterday])

the lib builds ok with 0 errors and 0 warnings

next attempt, to build jucedemo (used the codeblocks project file that comes in jucedemo folder)

imense list of linker errors

question:
does this means that the codeblock project file that comes in jucedemo has errors? (doesn´t include the proper libs needed to compile the demo)

don´t know if the above question apply because, i don´t know if is possible to inform inside a CBP (codeblocks project file) which libs should be used for the project.


#14

ok, whatever errors the linker gives, it´s only a matter of finding the proper lib that has the function.

the default installation of codeblock compiler (mingw included) is at:

c:\program files\codeblocks

and the location of the libs is at:

c:\program files\codeblocks\lib

if the build generates something like:

undefined reference to DrawDibDraw@52 it´s just a matter to locate inside the codeblocks lib folder which lib has the occurrence of the string "drawdibdraw"
in this case is the file: libvfw32.a or libmsvfw32.a

one of those two must be included in the project

to do this go to:
codeblocks/build/compiler options/linker/link libraries and add a reference to the file.

in my case the lib files that made de juce demo link were:

C:\juce\bin\codeblocks\libjucedebug.a
C:\Program Files\CodeBlocks\lib\libwininet.a
C:\Program Files\CodeBlocks\lib\libwinmm.a
C:\Program Files\CodeBlocks\lib\libws2_32.a
C:\Program Files\CodeBlocks\lib\libuuid.a
C:\Program Files\CodeBlocks\lib\libole32.a
C:\Program Files\CodeBlocks\lib\libmsvfw32.a

Is there some other solution better than adding by hand those files?

next case:

now that the juce demo compiled, let´s check the other examples…

C:\juce\extras\example projects\example_project_for_Win32

-where is the CBP codeblocks project file?

C:\juce\extras\the jucer\build

-where is the CBP codeblocks project file?

information on the juce FAQ internet page (today):

What compilers are supported?
On Windows, you can use VC6, VC7, VCExpress or ***Dev-C++***. On the Mac, XCode 2.0 or later. On Linux, GCC 3.3 or later. It’s probably quite easy to port to other environments, but these are the ones I currently maintain support for.

-There is no mention for codeblocks support, does it has full or partial or no support for codeblocks?
(just assumed that was full support and spent time installing codeblocks because i´ve accounted for ALL examples having proper CBP files, which was not the case)

-Where are the *.DEV (dev-cpp) files?
(just assumed that was full support and spent time installing dev-cpp because i´ve accounted for ALL examples having proper DEV files, which was not the case)

do you agree that that some revisions are necessary?


#15

I think Jules is in the process of phasing out DevCpp and phasing in Codeblocks/mingW. That’s why things are a little mixed up right now.


#16

yes, it’s still “work in progress”, but I just checked in a new version that should sort out those missing libs…


#17

I’ve just been trying to add a code::blocks project, but can’t get the >damn thing to compile, probably because of my mingw setup…
I’ve just checked in the new projects, so maybe some of you guys >who’ve already been using codeblocks could have a look and see if they >work for you? Ta!

rsrsrsrs… exactly my point…

i like it… it´s beautiful… (just the “nightly” version, the “stable” version is ugly and with several finishing problems i´ve just spotted after using it for 5 minutes, and mingw included is outdated) but after getting some headaches with the installation i gave it the nickname:

codebollocks

you see… i think everybody here that chooses either dev-cpp (no nickname yet) or codebollocks intends to use it with mingw (is that the case?) so i expect not only for it to be beautiful, but simple to install.

that means that, like dev-cpp, at least it should with the wxwidgets.dll and mingw and gdb in a single installation EXE file. is that too much to ask for? so they could make a zip file with all those things included. (and maintain it updated.) (at least they warn that the stable version is a YEAR OLD)

instead, if you start from scratch, to install it, you must go to several places, spot and download several files to make it work.

in this point dev-cpp is a winner, it installs flawlessly and comes with the latest mingw version included, which makes a big difference for new users entering the “fascinating” world of c++ windows developing…

http://www.youtube.com/watch?v=jweEK3JT7iQ

isn´t the majority using those ide´s for mingw anyway?

correct me if i´m wrong but…

codebollocks uses wxwidgets gui… so in order to use or compile juce gui with this beta nightly ide, first i have to install and see an ide with another gui? (one more score for dev cpp, [i guess it´s pure delphi without any gui]) (ooops… sarcastic thought… sorry)

best regards

bantri


#18

Alright, I noticed some confusion in this forum as to how to get Dev-C++, Code::Blocks, and MinGW to work together happily. Seeing as those are my preferred IDE’s and compiler, I guess I’d like to ask if people need a step-by-step on this? Yes, it’s very possible, even easy if you know how, to get both those IDE’s working with one MinGW install.

A super-short list of instructions below

Install MinGW at the C:\MinGW path. I installed it all, but you should only need the C++ compiler and other C related stuff.

Install the recent Code::Blocks, following the directions on their nightly builds forum, where ever you feel like. Do not include MinGW.

Install Dev-C++ where ever you feel like, without MinGW.

Code::Blocks:
Open up Code::Blocks, it will ask you what compiler to use, tell it MinGW if that’s an option. If not, just ignore it and move on. When C::B starts up, go to “Settings > Compiler and debugger…”, and it will open a new window.

Select the “Search directories” tab, and if it’s cool, it should already have MinGW\include selected, but if not, press the “Add” button and enter “C:\MinGW\include” into the text box. Then go to the ‘Linker’ sub-tab and do all of the same above except enter “C:\MinGW\lib” into the box. Do the exact same thing you did to the “Compiler” sub-tab to the “Resource compiler” sub-tab.

Then enter “Toolchain Executables”, put “C:\MinGW” into the installation directory and add to each text box this list as follows… (these really should already be there)

  • mingw32-gcc.exe
  • mingw32-g++.exe
  • mingw32-g++.exe
  • ar.exe
  • gdb.exe
  • windres.exe
  • mingw32-make.exe
    And after doing that select the “Additional Paths” sub-tab and insert “C:\MinGW\libexec\gcc\mingw32\3.4.5” (or whatever your installation version is, the recent one is 3.4.5) into that list. You will have to do this step if you selected MinGW at first or not!

Then go ahead and make a test program by creating a new Win32 GUI Project and seeing if it runs. Everything should be in order.

Dev-C++
Open up Dev-C++ and go through all of the beginning installation stuff. The beginning stuff should be pretty obvious, you can just continue on everything and it’ll run fine. After it opens, go to “Tools > Compiler Options”.

Select the “Directories” tab and make sure “C:\MinGW\bin”, “C:*DEV-CPP_DIRECTORY*\bin”, and “C:\MinGW\libexec\gcc\mingw32\3.4.5” are included in the “Binaries” sub-tab. Then go to the “Libraries” sub-tab and see if both the Dev-C++ and MinGW “\lib” files are included (add them if they’re not) in the same spirit as you did with the Directories tab. Then select “C Includes” and do the same as above except replace “lib” with “include”. Finally, the C++ Includes sub-tab should have the same thing as the C Includes tab except it also will have “C:\MinGW\include\c++\3.4.5” in it.

Then select the “Programs” tab, and ensure the list as follows is in each text box…

  • gcc.exe
  • g++.exe
  • mingw32-make.exe
  • gdb.exe
  • windres.exe
  • dllwrap.exe
  • gprof.exe
    And that’s it!

Once that’s done, everything should run perfectly. I believe that gcc.exe and mingw32-gcc.exe, as well as g++.exe and mingw32-g++.exe are interchangeable, but I haven’t experimented with that.

Have fun.

  • Zeke

#19

Hey people,

Don’t know if anyone’s noticed, but there’s a new release of the Code::Blocks IDE out (not just the nightly builds or a release candidate, but a proper release).

I tried building the JUCE library (1.45) with it, and unfortunately things didn’t go too smoothly. I got the following errors:

||=== Juce Library, Release ===|
C:\juce\src\juce_appframework\gui\graphics\colour…\colour\juce_PixelFormats.h||In member function `juce::PixelARGB* juce::ColourGradient::createLookupTable(int&) const’:expressionless:
C:\juce\src\juce_appframework\gui\graphics\colour…\colour\juce_PixelFormats.h|120|sorry, unimplemented: inlining failed in call to ‘void juce::PixelARGB::tween(const Pixel&, juce::uint32) throw () [with Pixel = juce::PixelARGB]’: function body not available|
C:\juce\src\juce_appframework\gui\graphics\colour\juce_ColourGradient.cpp|161|sorry, unimplemented: called from here|
||=== Build finished: 2 errors, 0 warnings ===|

Note the messages `sorry, unimplemented:’

I haven’t checked this out too thoroughly, but I guess it’s a Code::Blocks problem, seeing as the Juce library builds fine with the previous version (shame cos the new version of C::B looks much nicer!)


#20