Author Topic: General questions  (Read 20980 times)

Offline johne53

  • Regular
  • ***
  • Posts: 253
General questions
« on: April 20, 2007, 11:55:52 pm »
Hi there. Pretty soon I'll be starting a project that I need to compile for Linux. I don't have any real experience with Linux although I've been programming for Windows for over 10 years. I'm looking for an IDE that will give me similar functionality to MS Visual Studio and Code::Blocks is one of the products that's been mentioned to me. I just wondered about the following things:-

1) Will Code::Blocks allow me to do source level debugging of C++ apps (i.e. setting break points and stepping through the source code, line-by-line) ?
2) Does it have its own built-in compiler or does it use an external utility, such as 'Make' ?
3) Is it compatible with Scons? (Scons is an enhanced form of Make)
4) Does it have syntax highlighting - either using a built-in editor or via an external editor?

Thanks,

John

Offline raph

  • Almost regular
  • **
  • Posts: 242
Re: General questions
« Reply #1 on: April 21, 2007, 12:33:46 am »
Hi,
welcome to the forums
1) Will Code::Blocks allow me to do source level debugging of C++ apps (i.e. setting break points and stepping through the source code, line-by-line) ?
Yes
2) Does it have its own built-in compiler or does it use an external utility, such as 'Make' ?
It does not have any built-in compiler, since it is an ide.
Codeblocks does support a lot of different compilers. So you could e.g. write your applications with cb and compile them with microsofts compiler (visual C++).
You don't need Makefiles, since cb will know which commands to execute to compile your programs but you surely can use your own external application/script.
3) Is it compatible with Scons? (Scons is an enhanced form of Make)
Yes, you can write a scons script manually and let cb execute it.
4) Does it have syntax highlighting - either using a built-in editor or via an external editor?
Yes, just have a look at the screenshots.

Regards
raph

Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: General questions
« Reply #2 on: April 21, 2007, 09:49:55 am »
Thanks Raph - this sounds like it's exactly what I need. Just out of interest.... is this the same Code::Blocks product that can be found here:-

http://developer.berlios.de/project/showfiles.php?group_id=5358 ?

Don't be surprised if you can't get onto the Berlios web site. I've found it to be massively unreliable.

Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: General questions
« Reply #3 on: April 22, 2007, 04:22:48 pm »
Because I'm not too familiar with Linux yet, I might install the Windows version until I become familiar with Code::Blocks. I use MFC a lot - so should I choose the version with MINGW compiler or the version with no compiler? (in fact, is there even support for MFC?)

Offline raph

  • Almost regular
  • **
  • Posts: 242
Re: General questions
« Reply #4 on: April 22, 2007, 05:09:29 pm »
Because I'm not too familiar with Linux yet, I might install the Windows version until I become familiar with Code::Blocks. I use MFC a lot - so should I choose the version with MINGW compiler or the version with no compiler? (in fact, is there even support for MFC?)
It is highly recommended to not use version RC2 (its too old), but to use a current nightly version.
Grab a nightly here and migw, the win32 port of gcc, here.
Sorry, you won't be able to use mfc with mingw, since it is a microsoft product for sale (anyway, afaik it hasn't been improved for some time in favor of .net now).
I was using MFC, too and I recommend you to try out the wxWidgets framework.
It should be very easy for you, since wxWidgets code style is very similar to mfcs one (see this article: http://www.codeproject.com/library/wxwidgets.asp).
wxWidgets also has the advantage, that it is OpenSource, cross platform, and it looks native on each platform.

Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: General questions
« Reply #5 on: April 24, 2007, 08:18:29 am »
I've got some time today so I'll download the Windows version and give it a try. BTW, was MIGW a typo or is it an alternative version of MINGW - or are they both different products??

Also, is there ANY support for Microsoft compilers - even via MAKE ?

Offline raph

  • Almost regular
  • **
  • Posts: 242
Re: General questions
« Reply #6 on: April 24, 2007, 09:33:55 am »
I've got some time today so I'll download the Windows version and give it a try. BTW, was MIGW a typo or is it an alternative version of MINGW - or are they both different products??
Typo sorry.

Also, is there ANY support for Microsoft compilers - even via MAKE ?
Yes, CB does support Microsoft compilers (using build systems should be possible).
« Last Edit: April 24, 2007, 09:37:55 am by raph »

Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: General questions
« Reply #7 on: April 24, 2007, 12:53:35 pm »
Thanks again, raph.

Now this is going to sound like a dumb question - but if MS compiler is supported, why no support for MFC?

The whole of MFC is available as source code AFAIK...  :?:

Also - why no 'confused' icon - lol  :)

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: General questions
« Reply #8 on: April 24, 2007, 01:09:21 pm »
Now this is going to sound like a dumb question - but if MS compiler is supported, why no support for MFC?

C::B can compile MFC based code provided appropriate compiler settings, libraries are used.

Be a part of the solution, not a part of the problem.

Offline Charon

  • Multiple posting newcomer
  • *
  • Posts: 49
  • fnord
    • charon - where mental illness meets chronic nonsense
Re: General questions
« Reply #9 on: April 24, 2007, 02:41:17 pm »
Since you usually get MFC precompiled with the Microsoft Compiler, MINGW does not support it (this has something to do with ABI compatibility as long as i know, google can give you the proper answer).

Some sources on the net say that MFC *can* be compiled with MINGW (you get the sourcecode for it with the Microsoft Platform SDK), but the lincense forbids you to redistribute it.

Hi there. Pretty soon I'll be starting a project that I need to compile for Linux.
I hope you know that MFC is Microsoft only and can't be used on Linux.

So you better go with wxWidgets.

Good Luck
Markus
« Last Edit: April 24, 2007, 02:48:11 pm by Charon »
hi, i am a signature virus. please copy me into your sig!
Wish list : no root-node for workspaces, open files and symbols; world domination

Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: General questions
« Reply #10 on: April 24, 2007, 02:57:20 pm »
I hope you know that MFC is Microsoft only and can't be used on Linux.

Yes thanks - the only reason I'm asking is that all my existing projects are for Windows so my plan was to try out Code::Blocks with a project that I'm already familiar with. Ultimately of course I'll need the Linux installation but since I'm already familiar with Windows programming, I think that this approach might avoid me dealing with too many unknown quantities all at once.

Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: General questions
« Reply #11 on: April 25, 2007, 11:27:27 am »
Downloaded Code::Blocks this morning (from last night's build) but when I attempt to start it I get this error message:-

The application failed to start because wxmsw26u_gcc_cb.dll was not found.

Under Windows, DLL's normally reside in the \Windows\System or \Windows\System32 folders. I've tried putting the DLL into both those folders and I also put it into the same folder as codeblocks.exe (which, on my system, is E:\Program Files\CodeBlocks). However, I still get the error message. Any ideas?

Offline ANIRBAN GHOSH

  • Multiple posting newcomer
  • *
  • Posts: 19
Re: General questions
« Reply #12 on: April 25, 2007, 11:59:18 am »
Yes that happened because you have overwritten the old IDE files! Do not overwrite! Extract the 'build' into one folder other than the installed folder (ex C:\Code_Blocks), then put inside the dll files(mingw10 and wxmsw26u_gcc_cb.dll). Run the IDE from the exe in this folder.

Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: General questions
« Reply #13 on: April 25, 2007, 02:02:59 pm »
I'm sorry, I don't understand. I don't have any 'old' IDE. This is my first installation. Do you mean that I should have installed an older version first?

Offline Charon

  • Multiple posting newcomer
  • *
  • Posts: 49
  • fnord
    • charon - where mental illness meets chronic nonsense
Re: General questions
« Reply #14 on: April 25, 2007, 02:18:32 pm »
I guess he assumed that you are installing a nightly over an older RC2 installation.

Sorry, no idea for your specific problem :-(
hi, i am a signature virus. please copy me into your sig!
Wish list : no root-node for workspaces, open files and symbols; world domination

Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: General questions
« Reply #15 on: April 25, 2007, 02:34:48 pm »
Is it possible that I just didn't install it properly? I didn't run any setup program. I just used 7zip to extract the main file tree and I then placed the 2 required DLL's into the same folder as codeblocks.exe

Is there maybe something more that I should have done?

Offline ANIRBAN GHOSH

  • Multiple posting newcomer
  • *
  • Posts: 19
Re: General questions
« Reply #16 on: April 25, 2007, 02:44:59 pm »
Ok,then tell me how you have installed your nightly build over RC2. May be I can fix up your problem!

Offline Charon

  • Multiple posting newcomer
  • *
  • Posts: 49
  • fnord
    • charon - where mental illness meets chronic nonsense
Re: General questions
« Reply #17 on: April 25, 2007, 02:48:48 pm »
@ANIRBAN GHOSH: he didn't install a nightly build over RC2

@johne53:
No, thats exactly the right way to install a nightly.

But if i remember right there was another guy some time ago which used 7zip to extract codeblocks. His version corrupted some files though. After he upgraded 7zip to the newest version everything went right.
Maybe you should give this a try if you don't already have the newest 7zip version.

Just for completeness have a look at both attachments : folder.png shows you how the layout should look (i just didn't extend "templates") while content.png shows you which files should be in the top-most folder (named "CodeBlocks" in folder.png)

good luck
Markus

[attachment deleted by admin]
« Last Edit: April 25, 2007, 02:50:50 pm by Charon »
hi, i am a signature virus. please copy me into your sig!
Wish list : no root-node for workspaces, open files and symbols; world domination

Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: General questions
« Reply #18 on: April 25, 2007, 03:31:52 pm »
Ah - I just realised that the missing file is wxmsw26u_gcc_cb.dll (note the 'u').  Does this maybe denote a Unicode build?  If so, where do I get that DLL from?

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: General questions
« Reply #19 on: April 25, 2007, 03:37:45 pm »
Ah - I just realised that the missing file is wxmsw26u_gcc_cb.dll (note the 'u').  Does this maybe denote a Unicode build?
Yep, it looks like you inadvertently grabbed the ANSI build.

Quote
If so, where do I get that DLL from?
Further up in the same nightly build post:
http://prdownload.berlios.de/codeblocks/wxmsw26u_gcc_cb_wx2.6.3p2AndCbPatch_version3.7z
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: General questions
« Reply #20 on: April 25, 2007, 04:11:25 pm »
Thanks guys that seems to have fixed the problem.

Incidentally, I noticed that Code::Blocks freely loads up a Visual C++ project (in my case, Visual C++ 6) but when I try to compile it, I get an error saying "ComboDemo - Win32 Release" uses an invalid compiler [YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!]. Is that to be expected? Code::Blocks seemd to be happy to let me to select Visual C++ as a default compiler.

[Edit...] In fact, I've realised that I get the same message, no matter what compiler I select.
« Last Edit: April 25, 2007, 04:19:10 pm by johne53 »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: General questions
« Reply #21 on: April 25, 2007, 05:19:53 pm »
Code::Blocks seemd to be happy to let me to select Visual C++ as a default compiler.
If you haven't setup that compiler correctly (or any other you choose) C::B reports just the truth: The compiler is not (setup) valid. Verify the setup of your preferred compiler (is it installed at all?!).
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: General questions
« Reply #22 on: April 25, 2007, 05:36:29 pm »
Thanks Morten. What's the procedure for setting up a compiler? When I first launched C::B it listed about 15 compilers it had supposedly auto-detected (including several compilers that I didn't even know I had). I selected Visual C++ 2003 as the default compiler - then loaded a VC++ project. Do I also need to set up some compiler parameters or something?

Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: General questions
« Reply #23 on: April 25, 2007, 06:40:02 pm »
Okay, I found out how to set up the correct path to my compiler. Now when I try to compile my source file I get this message:-

Execution of 'cl.exe /nologo /MD /W3 /GX /O2 /DWIN32 /DNDEBUG /D_WINDOWS /D_AFXDLL /FD /Zp1 /D_MBCS /DFILETREECTRL_NO_RESOURCES   /c ComboDemo.cpp /FoRelease\ComboDemo.obj' in 'D:\Program Files\ComboDemoNew' failed.

Is there any way to get a report of why the failure happened?
« Last Edit: April 25, 2007, 06:55:32 pm by johne53 »

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: General questions
« Reply #24 on: April 26, 2007, 07:08:39 am »
This could be due to other reasons. Such as the Platform SDK path not found. Check whether it is in PATH or not.
Be a part of the solution, not a part of the problem.

Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: General questions
« Reply #25 on: April 26, 2007, 07:42:41 am »
Well the short answer is No, it isn't in my PATH variable. However, under DOS/Windows, the PATH variable has a limited number of characters. For at least the past 15 years it's been considered 'bad form' to be constantly adding folders into one's path. In fact, I tried a few things this morning - but I can't even find out how to change the PATH, these days. It used to be in AUTOEXEC.BAT but AFAIK, that isn't used these days. The path that's printed there doesn't bear much relation to my actual path....  :(

[Edit...] Just as an experiment, I've written a small batch file that adds the relevant directory to my path. When I now run C::B and try to compile the same file I get the same error message. I then copied the command line (issued by C::B) and pasted it into a terminal window. The error message that came up was "fatal error C1083: Cannot open source file: 'ComboDemo.cpp': No such file or directory"

This probably indicates that C::B needs to be sending the full path for each source file (instead of just it's name). Is there any way to achieve this?
« Last Edit: April 26, 2007, 08:13:45 am by johne53 »

Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: General questions
« Reply #26 on: April 26, 2007, 09:40:12 am »
I found out that I could add the full path using the 'Advanced Options' dialog (see my post, above). When I now attempt a compile, the same, lengthy 'failed' message appears - but of course, this time, it shows the full path to my source file, instead of just its name.

Once again, I copied the Code::Blocks command to my clipboard and pasted it into a terminal window. This time, the reason given for failure was:-

fatal error C1083: Cannot open include file: ‘afxwin.h’: No such file or directory

I can solve that quite easily - but my question is this.... will I ever get to the stage where C::B is giving me 'human friendly' error messages, like the above? Under Settings->Other settings, there are various options for Compiler Logging. However, none of those options seems to give me meaningfull error messages. What am I doing wrong here? I don't see how it can be possible to compile anything if the only errors flagged up are 'success' or 'failure'.

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: General questions
« Reply #27 on: April 26, 2007, 09:47:26 am »
Look at the Red coloured messages. They indicate error messages. Read them and you'll get better understanding of the problem.

By the way C::B doesn't generate those error messages. It's the compiler which throws that message. C::B merely presents it in a nice format.
Be a part of the solution, not a part of the problem.

Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: General questions
« Reply #28 on: April 26, 2007, 09:50:00 am »
The red ones are the ones I'm talking about. Is it possible that I'm looking in the wrong place? I currently have the 'Build Log' tab selected for viewing. Is that right or wrong?

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: General questions
« Reply #29 on: April 26, 2007, 09:56:55 am »
No you are at the right place.

If possible, please attach a full build-log with your reply so that people can help you better. :)
Be a part of the solution, not a part of the problem.

Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: General questions
« Reply #30 on: April 26, 2007, 10:50:49 am »
This is the full build log that I'm seeing:-

Quote
Execution of 'cl.exe /nologo /MD /W3 /GX /O2 /DWIN32 /DNDEBUG /D_WINDOWS /D_AFXDLL /FD /Zp1 /D_MBCS /DFILETREECTRL_NO_RESOURCES  /I"E:\Program Files\Microsoft Visual Studio\VC98\Bin\include" /I"D:\Program Files\ComboDemoNew" /c "D:\Program Files\ComboDemoNew\ComboDemo.cpp" /FoRelease\ComboDemo.obj' in 'D:\Program Files\ComboDemoNew' failed.
Nothing to be done.

That was in response to pressing CTRL+SHIFT+F9 (i.e. just attempting to compile 1 x source file). I've tried 2 x compilers - namely Visual C++ 6.0 and Visual C++ 2003. I get the same message in either case. I can't help feeling that I need to 'turn something on' in order to see the compiler's actual output. Or do I maybe have to redirect it somewhere (e.g. via a pipe?)
« Last Edit: April 26, 2007, 10:52:26 am by johne53 »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: General questions
« Reply #31 on: April 26, 2007, 11:14:44 am »
Please post a minimal example to reproduce. MS Visual C++ v6.0 isn't supported by C::B natively. It can be attached (there is an article in the WiKi) but I wonder if you had used that information?
Anyway: Have a look at my sig to see the full compiler command...
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: General questions
« Reply #32 on: April 26, 2007, 11:33:10 am »
Thanks Morten. I switched to "Full command line" which simply gives me this output:-

Quote
cl.exe /nologo /MD /W3 /GX /O2 /DWIN32 /DNDEBUG /D_WINDOWS /D_AFXDLL /FD /Zp1 /D_MBCS /DFILETREECTRL_NO_RESOURCES  /I"E:\Program Files\Microsoft Visual Studio\VC98\Bin\include" /I"D:\Program Files\ComboDemoNew" /c "D:\Program Files\ComboDemoNew\ComboDemo.cpp" /FoRelease\ComboDemo.obj
Execution of 'cl.exe /nologo /MD /W3 /GX /O2 /DWIN32 /DNDEBUG /D_WINDOWS /D_AFXDLL /FD /Zp1 /D_MBCS /DFILETREECTRL_NO_RESOURCES  /I"E:\Program Files\Microsoft Visual Studio\VC98\Bin\include" /I"D:\Program Files\ComboDemoNew" /c "D:\Program Files\ComboDemoNew\ComboDemo.cpp" /FoRelease\ComboDemo.obj' in 'D:\Program Files\ComboDemoNew' failed.
Nothing to be done.

I'll try the wiki and if that doesn't make things any clearer, I'll post a small project.

Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: General questions
« Reply #33 on: April 26, 2007, 01:04:57 pm »
I think that the wiki must be referring to an older version. It says:-

Quote
The compiler/linker setup (tab "Directories) should be done as following:
Under the tab "Compiler" add the following path's:
{YOUR_MSVC6}\VC98\Include
{YOUR_MSVC6}\VC98\MFC\Include
{YOUR_MSVC6}\VC98\ATL\Include

Under the tab "Linker" add the following path's:
{YOUR_MSVC6}\VC98\Lib
{YOUR_MSVC6}\VC98\MFC\Lib

Under the tab "Resource compiler" add the following path's:
{YOUR_MSVC6}\VC98\Include
{YOUR_MSVC6}\VC98\MFC\Include
{YOUR_MSVC6}\VC98\ATL\Include


However, I can't seem to find any of those tabs...  :(

Offline Charon

  • Multiple posting newcomer
  • *
  • Posts: 49
  • fnord
    • charon - where mental illness meets chronic nonsense
Re: General questions
« Reply #34 on: April 26, 2007, 01:11:58 pm »
Some time ago one tab-page was changed to a drop-down list.

Select "Search directories" in dthe drop-down list, then you will see your tabs.

Markus

[attachment deleted by admin]
hi, i am a signature virus. please copy me into your sig!
Wish list : no root-node for workspaces, open files and symbols; world domination

Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: General questions
« Reply #35 on: April 26, 2007, 02:26:50 pm »
Woohoo...! It's looking good.... I still need to add a few more search directories (to match my existing setup) but finally, I seem to be seeing real compiler warnings.  :D

Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: General questions
« Reply #36 on: April 26, 2007, 03:34:38 pm »
I've managed to build and run a complete MFC application but I'm not sure whether I'll be able to debug it (i.e. single stepping etc). Would I need to use a separate debugger to achieve this? As far as I can see, there's no separate debugger supplied with VC++.