Title: Yoohoo! Dr. Voodoo!
Dragon - July 19, 2003 02:14 AM (GMT)
Sorry about the weird title. :P
Dr. Voodoo, you are using Borland's C++ compiler (the commandline version), correct? I'm thinking that if it's better than Dev-C++, I might download it, too. Can you give me some information about it on the following areas?
1. Compiled file size - Is it smaller than that of Dev-C++?
2. Can it compile different types of files (win32 GUI, console, DLL, etc.)?
Thanks.
dr voodoo - July 19, 2003 08:33 AM (GMT)
The compiled size is about the half of them from Dev-C++ but you can tell the compiler to optimize size or speed. If you select size it will probably even be smaller. It can do everything that Dev-C++ can do. But the setup is a bit more difficult, first you need a text editor (ex: Notepad or the built-in one of Dev-C++ or DT's). Secondly you need the compiler. Here's the link:
ftp://ftpd.inprise.com/download/bcppbuild...ndLinetools.exeIt's 8mb if I remeber correctly but you can download it quickly because of the ftp server. Now You must go to this site:
http://community.borland.com/article/0,1410,21205,00.htmlIt are the installation instructions and a test with a little hello word program. (NOTE that the hello word has no break so the console window will appear and disappear immediately)
Now to use it handy you need to know one or two things about batch (*.bat) file. Do you or do I have to give you a quick crash course? (Reply because there are a few thing I still have to tell you!)
PS: Here's also a good complet Win32 reference for that compiler (Download it! It's much more handy than MSDN!):
http://www.borland.com/devsupport/borlandc...es/BC52HLP1.ZIP
Dragon - July 19, 2003 09:10 PM (GMT)
[EDIT]
Dr. Voodoo, no need for that. I can't seem to get the thing to work right. I tried the configuration instructions, but there weren't any instructions for Win ME! The others ones didn't work, either. Thanks anyways.
dr voodoo - July 20, 2003 08:36 AM (GMT)
Try if this works:
Open the Bin directory. Add 2 simple text files. Name them:
bcc32.cfg
ilink32.cfg
Open them with Notepad:
Write into bcc32.cfg:
-I"c:\Borland\Bcc55\Include"
-L"c:\Borland\Bcc55\lib"
And in ilink32.cfg:
-L"c:\Borland\Bcc55\lib"
If you haven't moved/changed or deleted any files of the compiler it should work now. The part with the "Environment variables" is very useful if you have it but it will also work without.
To start a new project. Create first an empty folder for it (I'll make C:\cpp\hello\). Now add 2 new text files to it:
compile.bat
main.cpp
In main you put your c++ code best use something simple for a start:
| CODE |
#include <iostream> using namespace std; int main() { cout<<"Hello"<<endl; system("pause"); } |
Now open compile.bat write the following in it:
| CODE |
@echo off del main.log del main.exe cd C:\Borland\BCC55\Bin bcc32 -WC -eC:\cpp\hello\main.exe C:\cpp\hello\main.cpp>C:\cpp\hello\main.log del main.obj cd C:\cpp\hello del main.tds |
If you now double click on compile.bat 2 files will be added:
main.log
main.exe
main.exe is our compiled hello word and main.log is a txt file containg errors and warnings from the compiler it will always be created even if everything is fine with your main.cpp.
When you start a new project you will have to adoped the pathes in compile.bat
If the "Environment variables" were working we wouldn't need any pathes.
Now you know how to compile as console. To compile as GUI we must change the bat file a little:
Do you see that -WC after bcc32? It stands for windows console. To compile as GUI we need to change it to -W and for a dll to -WD (I haven't yet tried -WD but it's written like that in the compiler docs).
*.rc are harder to compile. Try first to get familar with what I said above.
PS: A little console app could perhaps solve the problem with the bat file by simply checking it's path to find the paths of main.cpp
Dragon - July 21, 2003 12:00 AM (GMT)
Okay, the compiler works correctly and I successfully compiled a simple GUI project. However, when I run compile.bat it displays 'File not found' on two lines on the screen. Is this supposed to happen? The files are compiled, but 'File not found' is displayed, so I'm just wondering about this.
dr voodoo - July 21, 2003 09:13 AM (GMT)
It's correct. With the lines:
del main.log
del main.exe
We try to delete the main.exe and .log so that in case of an error in the code we directly know without even looking in the log that there was an error but if we compile the project a first time there's no main.exe or main.log so we get an error.
Dragon - July 21, 2003 06:12 PM (GMT)
So you mean the first time I compile it's supposed to do this?
File not found
File not found
Also, how do I set the icon of a compiled file? In Dev-C++ you can go to Project Options, but of course it's different here.
dr voodoo - July 21, 2003 08:32 PM (GMT)
| QUOTE |
| Also, how do I set the icon of a compiled file? In Dev-C++ you can go to Project Options, but of course it's different here. |
I'm not too sure about this but I read somewhere that windows searches for the first icon in the exe, so the icon with the lowest ID. This needs the use of *.rc files. I have no problems compiling the *.rc to a *.res but I'm having problems linking the *.res into the *.exe.
Dragon - July 21, 2003 08:36 PM (GMT)
Okay, can you give me an example on using both large and small icons when you figure it out? Large icons as in 32x32 icons for the program and small icons as in the 16x16 icons in the left corner of the program.
Also, I always get these lines in my 'main.log' file:
| QUOTE |
Borland C++ 5.5.1 for Win32 Copyright © 1993, 2000 Borland c:\borland\bcc55\projects\main.cpp: Warning W8057 c:\borland\bcc55\projects\main.cpp 48: Parameter 'hPrevInstance' is never used in function __stdcall WinMain(HINSTANCE__ *,HINSTANCE__ *,char *,int) Warning W8057 c:\borland\bcc55\projects\main.cpp 48: Parameter 'lpCmdLine' is never used in function __stdcall WinMain(HINSTANCE__ *,HINSTANCE__ *,char *,int) Turbo Incremental Link 5.00 Copyright © 1997, 2000 Borland |
Why are the warnings there (the source is compiled correctly)? I never got those in Dev-C++.
Also, when compiling a file (let's say 'src.cpp'), does it create a file called 'src.obj'? If so, what does that file ('src.obj') do?
Dr. Voodoo, if you want you can check out a program I found. It's called ACE (Another C++ Editor) and it's only 180 KB. You can download it at download.com. It's designed for the Borland C++ Compiler (as well as MSVC++, I think, but I'm not sure). You can specify all the options in the program, such as type of application (DLL, console, etc.). I find it to be useful because I don't have to edit the '.bat' file every time I want to change some options to compile. The editor isn't syntax highlighted, but you can use other editors for that if you want to.
Thanks for all the help!
dr voodoo - July 22, 2003 12:10 PM (GMT)
| QUOTE |
| QUOTE | Borland C++ 5.5.1 for Win32 Copyright © 1993, 2000 Borland c:\borland\bcc55\projects\main.cpp: Warning W8057 c:\borland\bcc55\projects\main.cpp 48: Parameter 'hPrevInstance' is never used in function __stdcall WinMain(HINSTANCE__ *,HINSTANCE__ *,char *,int) Warning W8057 c:\borland\bcc55\projects\main.cpp 48: Parameter 'lpCmdLine' is never used in function __stdcall WinMain(HINSTANCE__ *,HINSTANCE__ *,char *,int) Turbo Incremental Link 5.00 Copyright © 1997, 2000 Borland |
Why are the warnings there (the source is compiled correctly)? I never got those in Dev-C++.
|
mingw also probably generates these warnings but doesn't shows them because you (Dev-C++) told it to ignore them. You can also tell Bc++ (Borland C++) to ignore them by adding this switch
-w-warning number
So in this case
-w-8057
| QUOTE |
| Also, when compiling a file (let's say 'src.cpp'), does it create a file called 'src.obj'? If so, what does that file ('src.obj') do? |
It creates such a file. I don't really know for what it is but probably it's only some temporary file the compiler creates to free some place in memory but I could be wrong. Anyway after sucessful compiling you can delete it.
| QUOTE |
| Dr. Voodoo, if you want you can check out a program I found. It's called ACE (Another C++ Editor) and it's only 180 KB. You can download it at download.com. It's designed for the Borland C++ Compiler (as well as MSVC++, I think, but I'm not sure). You can specify all the options in the program, such as type of application (DLL, console, etc.). I find it to be useful because I don't have to edit the '.bat' file every time I want to change some options to compile. The editor isn't syntax highlighted, but you can use other editors for that if you want to. |
I'll perhaps take a look but I'm actualy fine with what I have. My bat files are much than yours as already mentioned above:
| QUOTE |
| If the "Environment variables" were working we wouldn't need any pathes. |
They work for me so my bat file looks like this
| CODE |
@echo off del main.log del main.exe bcc32 -W main.cpp>main.log del main.obj del main.tds |
If I keep the name main.cpp I only need to copy paste it from another project and to be honest I write faster such a bat file than setting options in Dev-C++. As text editor I use DT's new one. It loads fast and has color highlighting for C++, for the rest it's mainly a Notepad clone with some minor beta version bugs.
dr voodoo - July 22, 2003 05:10 PM (GMT)
| QUOTE |
| It creates such a file. I don't really know for what it is but probably it's only some temporary file the compiler creates to free some place in memory but I could be wrong. |
I was wrong. I don't know exactly what it is but something like a not linked exe (so if you use a linker you probably need that file). Anyway found a way to compile&link rc files.
First we need to add a line to main.cpp:
| CODE |
| #pragma resource "resource.res" |
And here's the new bat file
| CODE |
@echo off del main.log del main.exe C:\Borland\BCC55\Bin\brc32.exe -r resource.rc>main.log copy resource.res C:\Borland\BCC55\Bin\resource.res C:\Borland\BCC55\Bin\bcc32.exe -W main.cpp>>main.log del C:\Borland\BCC55\Bin\resource.res del resource.res del main.obj del main.tds del TMP1.$$$ |
And the best thing is you don't need to change any paths! You can simply put it in any directory without needing to change any paths even if the "Environment variables" aren't working. (I didn't know you could call exes that way). Anyway that bat file compiles main.cpp and links resource.rc to it all in one.
And the icon windows shows as exe icon is the icon linked first to the exe. This means in resource.rc you add
And icon.ico will be the icon which will be displayed
Dragon - July 22, 2003 09:45 PM (GMT)
That doesn't work for me. This is part of the contents of the 'main.log' file:
Error E2133: Unable to execute command 'ilink32.exe'
[EDIT]
Okay, now when I try to compile it normally it doesn't work either. I will download it and try it again.
[EDIT]
It still doesn't work. Part of the main.log file is still:
Error E2133: Unable to execute command 'ilink32.exe'
Can you give me EXACT instructions (unless those were already exact), such as including file paths so I can see how it's done?
dr voodoo - July 23, 2003 10:41 AM (GMT)
ilink32.exe is the linker it should be called by bcc32 (code compiler) when you include
#pragma resource "resource.res"
to the code.But to get "resource.res" we must first compile "resource.rc" this is done by brc32.exe and by adding an -r switch to it. Note that #pragma resource "resource.res" searchs (when calling the compiler by the full path) in the "C:\Borland\BCC55\Bin" directory and not in your project directory
Look if you have a file named "C:\Borland\BCC55\Bin\ilink32.exe" if not delete the whole C:\Borland\BCC55 directory and reinstall the compiler (reextract and add the *.cfg files as explained above).
If the compiler isn't messed up make sure the *.rc isn't empty (add a little icon if it is).
You could also take a look at "theForger's Win32 API Tutorial" it includes a section about using the commandline compiler. But note that it's writen for the case where the "Enviroment Varibals" work!
Dragon - July 23, 2003 07:33 PM (GMT)
But the weird thing is 'ilink32.exe' is where it's supposed to me, and it doesn't work even after I deleted everything and downloaded the file again.
dr voodoo - July 24, 2003 02:28 PM (GMT)
Sorry I don't know what's wrong. It works for me.