Author Topic: console apps with borland  (Read 7488 times)

Anonymous

  • Guest
console apps with borland
« on: February 08, 2005, 06:16:54 pm »
Hello,

when I found this nice IDE, I began to reactivate my old borland free commandline tools, downloaded the code::blocks 1.0-beta5 and run the installation procedure. code::blocks detects my borland bcc32 installation and I could try my first hello world program. but what I got was ... grrr!

Now, what I found out. Everytime I create a "New Project" the code::blocks IDE generates a "Default target" for GCC, though, I did not have installed MinGW. So I had to change the compiler within the "Build options". Did I made something wrong while installation of code::blocks? I set borland compiler to default!

When trying to compile console applications, you will get a lot of error messages. Because the linker options are not set correctly.
windows gui applications:
$linker -aa $libs c0w32  cw32.lib import32.lib ...
console applications:
$linker -ap $libs c0x32 cw32.lib import32.lib
The difference is just the x instead of the w within the object file and the parameter -ap instead of -aa!

Now everythings compiles fine, but which is the best way to have two different linker settings, for console and windows applications? I made a copy of the whole compiler settings and renamed it to Borland Console Applications, but I think there is perhaps a better way?

Thanks,
Stefan

Offline Faultier

  • Multiple posting newcomer
  • *
  • Posts: 13
    • http://
console apps with borland
« Reply #1 on: February 09, 2005, 01:55:21 pm »
Hi,
the previous post was mine. Now I want to add the following.
I changed the "Command line macro" for "Link object files to executable" within the "Advanced compiler options" to "$linker $libs $link_options $link_objects, $exe_output, , cw32.lib import32.lib".
If you want to compile a console application just add "-ap c0x32" as linker options within "Project's compiler options" for all your targets, and "-aa c0w32" for windows gui applications. If you like to have unicode applications, then you add a "w" to the name of the startupcode objectfile, like "c0x32w".
Bye,
Stefan

Anonymous

  • Guest
console apps with borland
« Reply #2 on: March 26, 2005, 12:57:15 pm »
I have spent lot of time trying to compile a simple console project but get somewhat same result as Stefan did.  I think this can be retified without much work to the source code of the templates part and so I sincerely hope that the development team could kindly make this true.  For new comers to programming like me, it is not only necessary to learn the language basic but also the compile and link options.  With the great export makefile function, it will be a very good learning tool for new comers.

Offline Faultier

  • Multiple posting newcomer
  • *
  • Posts: 13
    • http://
console apps with borland
« Reply #3 on: March 26, 2005, 01:16:37 pm »
Hi,
it becomes more simple with the beta6. If you create a new project, you can choose the console application template. Then you just need two static libraries "cw32.lib" and "import32.lib" to create single threaded simple console applications.
Bye,
Stefan