• Advertisement

Archived

This topic is now archived and is closed to further replies.

Builder 3.0 / 4.0 simple compilation question

This topic is 6251 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This is most lkely a VFAQ but I can''t see a FAQ for this forum... What''s the best way of using the C++Builder IDE to compile programs such as the ones in the interactive tutorial? These compile fine using the command line tools, eg bcc32 -W -egame.exe *.cpp ddraw.lib seems to do the job most of the time. BUT there''s no debugger and no interactive help in Notepad . I have the free versions of C++Builder 3 and 4 Professional.

Share this post


Link to post
Share on other sites
Advertisement
I believe you can get a debugger from borland.com.
As for help ... your on your own.
To compile bigger apps, tutorials, etc. you will need to create a make file, and use make.exe to make the makefile - which is aptly named makefile.
Umm about the makefile syntax I don''t know it, so you''ll have to see if borland.com has any info on that.
And about the FAQ for this forum - turbo well hasn''t created one yet.

------------------------------
BCB DX Library - RAD C++ Game development for BCB

Share this post


Link to post
Share on other sites
quote:
Original post by c++freak

I believe you can get a debugger from borland.com.
As for help ... your on your own.
To compile bigger apps, tutorials, etc. you will need to create a make file, and use make.exe to make the makefile - which is aptly named makefile.
Umm about the makefile syntax I don''t know it, so you''ll have to see if borland.com has any info on that.
And about the FAQ for this forum - turbo well hasn''t created one yet.

------------------------------
BCB DX Library - RAD C++ Game development for BCB


So are you saying that I''m better off sticking with command-line tools than persuading Builder to do what I want? Surely Builder has to be easier to use once it''s set up.

IS this possible?

Share this post


Link to post
Share on other sites
You should just be able to create a new project, remove all default files in the project and add the files you want to use to the project.

Share this post


Link to post
Share on other sites
Oohhh ooohhhh sorry. I thought you *ONLY* had the commandline tools.
If you have proper Builder then:
1) For a windoze apps that are *NOT* MFC then just create a new app, remove the form, and copy the main cpp (one containing WinMain) to the project cpp. Then add the rest.
2) For a library do a create new library (from File|New ...) and then add the files.
A tip - use Drag & Drop the get ONLY the files u need Its really usefull - for everything.


------------------------------
BCB DX Library - RAD C++ Game development for BCB

Share this post


Link to post
Share on other sites
OK C++freak, I think I''ve got it...sort of. What''s the best way to use resources with C++Builder? I know you can include compiled .res files but this is a pain (writing the .rc files by hand) and I can''t get the ide to compile them automatically anyway (despite trying to tweak the makefile -- there are some fields it won''t let me touch in BCB 3).

Another approach I tried is to include an invisible form, dump all of the resources onto it (I only have one bitmap in my example, which I store in a TImage) and reference it''s handle. (eg one line I have is

HBITMAP hbm = Form1->Image1->Picture->Bitmap->Handle;

and then I use hbm in windows api calls). This compiles ok but the image I get is all black (or it''s empty), not the one the ide shows in Form1.

Why is this? Do I need some code to tell the TImage to actually load the image or update the Handle or something?

Share this post


Link to post
Share on other sites
Why do you need the HBITMAP of the TImage? In matter of fact, you don''t even need the invis. form.
If your attempting to load a bitmap for your game (i''m assuming that cos this is a GAME dev forum) you can do this:
  
TBitmap* Bitmap = new TBitmap;
TFileStream* Stream = new TFileStream("c:\\pic.bmp",fmOpenRead);
Bitmap->LoadFromStream(Stream);
// do something with it ... example: get pixels to set to DX8 surf.

delete Stream;
delete Bitmap;

Another thing ... if you''re starting with the DX tutorials, what you might want to do is use the form / RAD capabilites of C++Builder to setup Windows, then ''transplant'' the DX code into the form.
Anyway, hope that helped


------------------------------
BCB DX Library - RAD C++ Game development for BCB

Share this post


Link to post
Share on other sites
hmmm... I''m sure that this will work. But is there any way of getting the bitmap file compiled into the .exe (as a resource)? Somehow it seems neater than leaving the image on disk.

Also presumably the method you use is not so easily adapted to menus and dialog boxes...

Share this post


Link to post
Share on other sites
You can load your image into a TImage using the GUI, then use the Graphics::TBitmap property to get access to the image in code.

Graphics::TBitmap* temp=new Graphics::TBitmap(imgBkg->Picture->Bitmap);

Share this post


Link to post
Share on other sites
Yep thats true. For GUI''s resources and suchlike you can just use the RAD tools. For example if you want to have a menu with a bitmap for each action (file new, etc.) you can simply setup a TImageList and then get each picture for the action from that.
For resources (contained in exe''s) I''m not particularly sure. However given the track record of BCB I think u can just do some kind of insert from resource.
Oh yeah to easily create resource files (*.res) you can use the ImageEditor tool included with BCB.

------------------------------
BCB DX Library - RAD C++ Game development for BCB

Share this post


Link to post
Share on other sites

  • Advertisement