Author Topic: Code::Blocks - Working in 'Old Mode'  (Read 6801 times)

Offline diego_pmc

  • Single posting newcomer
  • *
  • Posts: 9
Code::Blocks - Working in 'Old Mode'
« on: October 01, 2009, 03:02:18 pm »
Hello,
I was wondering if there is any way to make Code::Blocks work in 'old mode' i.e. to work just like Borland C++ from 1997: no namespaces, void main() allowed, ".h" necessary even for standard headers, etc.

I personally do not plan to use this feature, but I was just curious if it exists and if so, how I can use it. I've looked under the settings tab and set Borland C++ (5.5, 5.82) as my default compiler, but when I try to compile something simple, it doesn't do anything.

Also, is there any way to make CB open up a new empty file every time I start it?

Thanks!
« Last Edit: October 01, 2009, 03:19:05 pm by diego_pmc »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12121
    • Travis build status
Re: Code::Blocks - Working in 'Old Mode'
« Reply #1 on: October 01, 2009, 03:44:45 pm »
1. CB is not compiler  :lol: :lol: :lol: :lol:
2. CB can be made to work with any compiler out there
3. Why on earth would you want to use such compiler and waste time on the past technology?  :shock: :?

Also, is there any way to make CB open up a new empty file every time I start it?
You could look at the scripting features of C::B
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline diego_pmc

  • Single posting newcomer
  • *
  • Posts: 9
Re: Code::Blocks - Working in 'Old Mode'
« Reply #2 on: October 01, 2009, 03:58:53 pm »
1. I know, but wasn't there an IDE called Borland C++, just like the compiler of the same name?
3. I won't use it, but at school we use a really really old IDE, Borland C++ (at least according to the window title), and it is FULL of errors. It has more errors than features. Literally. Just today I had a really easy program to write in class, but I chose to write it in Notepad, because the IDE gives errors when I press back space, delete, right-click, cannot properly read the number of lines in a program (mine supposedly had ~3500, when it actually had around 20), and finds errors where there really are none.

The teacher asked us to tell her about a free, newer (and working :D) IDE. I was planning on telling her about CB, but I'm afraid she won't want it unless it can be used for programs written in the 1997 version of C++.

Even if the language is older, I'll still be happy just because I won't have to use the IDE we have in class anymore.  

Online stahta01

  • Lives here!
  • ****
  • Posts: 6671
    • My Best Post
Re: Code::Blocks - Working in 'Old Mode'
« Reply #3 on: October 01, 2009, 05:31:08 pm »
The below compiles and runs for me. No idea if cin works right your sample code does not test that well.
I used C::B SVN 5731. Should work with most C::B Nightly reply to this thread if 8.02 release does not work for you. The teacher/instructor would most likely want a set release to test it.

Note: Code::Blocks does NOT support debugging of Borland code; but, about 6 months ago someone mentioned a third party option for Borland debugging no idea if it supported the old Borland 5.5 code.
http://forums.codeblocks.org/index.php/topic,10597.0.html
http://www.ollydbg.de/ an shareware debugger no idea if it really works with Borland Code well or if using it will be easy with code blocks.

Added the libraries "cw32", "Kernel32", and "user32" to get it to link.
Note: the "cw32" library was a random guess.

Improved test code used below to test cin and set valid exit code was returning a weird exit code.
Code: [Select]
#include <iostream.h>

void main()
{
    cout << "works\n";
    int a;
    cin >> a;

    cout << a << "\n";

    exit(0);
}

Cmd window output below for me entering a 7
Code: [Select]
works
7
7

Process returned 0 (0x0)   execution time : 2.734 s
Press any key to continue.
Using Borland bcc 5.5 installed in folder "C:\GreenApps\BCC55"

Code: [Select]
bcc32 -v
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland

ilink32.cfg contains
Code: [Select]
-L"C:\GreenApps\BCC55\lib;C:\GreenApps\BCC55\Lib\PSDK"

bcc32.cfg contains
Code: [Select]
-I"C:\GreenApps\BCC55\include"
-L"C:\GreenApps\BCC55\lib;C:\GreenApps\BCC55\Lib\PSDK"

Tim S.
« Last Edit: October 01, 2009, 06:10:16 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1442
    • CenizaSOFT
Re: Code::Blocks - Working in 'Old Mode'
« Reply #4 on: October 01, 2009, 06:03:35 pm »
It sucks when teachers do not get up to date. I also had a similar problem at the university. They were teaching us "C++" (it was actually C, except that we used iostream instead of stdio most of the time) using Turbo C++ 3.0. Good thing it was only the very first few semesters and not the whole career.

Using Code::Blocks with an old compiler may be an option to get things going, but your teacher should really consider learning and teaching the real and up to date thing. It's not like there are no options freely available at all. Code::Blocks is one of them, Visual C++ Express is another.

Good luck.

Offline diego_pmc

  • Single posting newcomer
  • *
  • Posts: 9
Re: Code::Blocks - Working in 'Old Mode'
« Reply #5 on: October 04, 2009, 08:47:55 am »
@stahta01: Thanks, but how do I make CB use the new debuger? (Where do I have to place odbg's files, how do I make CB aware that they exist, etc.)

Also, is it possible to do this:
is there any way to make CB open up a new empty file every time I start it?

Online stahta01

  • Lives here!
  • ****
  • Posts: 6671
    • My Best Post
Re: Code::Blocks - Working in 'Old Mode'
« Reply #6 on: October 04, 2009, 06:06:24 pm »
@stahta01: Thanks, but how do I make CB use the new debuger? (Where do I have to place odbg's files, how do I make CB aware that they exist, etc.)

Also, is it possible to do this:
is there any way to make CB open up a new empty file every time I start it?

Use it as a stand alone debugger or use the normal Borland debugger as a standalone.

If you wish to use it with Code::Blocks then you must learn to solve the problem yourself.

To make it a plugin will take many hours of work if it is possible.

To call it as an external tool will take less than 15 minutes work.

Students need to learn to think and solve problems please research the above and decide which you are going to do. Then do it.

Very Large hint: http://www.codeblocks.org/docs/main_codeblocks_en.html

Quote
an shareware debugger no idea if it really works with Borland Code well or if using it will be easy with code blocks.
NOTE: As I have implied I have never used Ollydbg.

Tim S.
Teaching Assistant
« Last Edit: April 13, 2010, 02:29:24 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org