Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / #Include, what is it good for?

Author
Message
EvilKnuckles 666
21
Years of Service
User Offline
Joined: 23rd Jun 2003
Location:
Posted: 11th Feb 2004 23:43
What's the #Include (i think that's how it is) good for? and how would you use it?
sponge008
20
Years of Service
User Offline
Joined: 8th Feb 2004
Location: MA, USA
Posted: 12th Feb 2004 00:36
Well, I'm new myself, but I am pretty good with C++, and that's the first command you learn in C++. So, I'm not sure what it does in DB.
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 12th Feb 2004 00:39
includes are just code modules aside from the default one generated when you start a new project. It's a good way to organize your code. Use the project manager thing in the IDE to include external code modules, don't use include command - it's bugged. C++ includes are beyond the scope of dbp as c++ includes are function libraries and headers.



-RUST-
"What the... Mooooooooooo!"
EvilKnuckles 666
21
Years of Service
User Offline
Joined: 23rd Jun 2003
Location:
Posted: 12th Feb 2004 00:43
hmmm, yea, i read that it was like that. i was thinking of putting all of my functions on that (i have alot for the game i'm making) and just having the default one as the main code loop.

crap, wait, u said it's bugged? how is it bugged?
Brian T
20
Years of Service
User Offline
Joined: 8th Feb 2004
Location: Western Massachusetts, USA
Posted: 12th Feb 2004 01:16
I have a question about using additional functions via include. Do such functions have access to your global variables or do you have to send them? Thanks.

* There is no experience like creating your own universe *
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 12th Feb 2004 01:23
@ EK666 - I meant don't use #include command from code, use the project manager to add the included files to the project, the code-only version has been known to be buggy.

@ brianT - I haven't tried that yet. Someone here will know tho.

-RUST-
"What the... Mooooooooooo!"
EvilKnuckles 666
21
Years of Service
User Offline
Joined: 23rd Jun 2003
Location:
Posted: 12th Feb 2004 01:32
oh, ok, kool, thanks
the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 12th Feb 2004 01:52
When you inclue a file in the ide project tabs the ide just appends it to your main source file when it is compiled so all your functions work the same as if they where at the bottom of your main source file.

Our civilization faces three great dangers. The first is destruction by a nuclear war, the second is being crippled with overpopulation and the third is the Age of Leisure.
hexGEAR
21
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 12th Feb 2004 02:34
and to conclude, yep, global variables can be used absolutely anywhere, provided they are declared in the main project file.

Philip
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 12th Feb 2004 07:14
Hexgear, thats not quite right. Global variables can be used absolutely anywhere provided they are declared outside a function.

I say this because in my project I have global variables being declared outside a function in my #included files. They work fine.

Philip

What do you mean, bears aren't supposed to wear hats and a tie? P1.3ghz / 384 megs / GeForce MX 5200 128meg / WinXP home
BearCDPOLD
20
Years of Service
User Offline
Joined: 16th Oct 2003
Location: AZ,USA
Posted: 13th Feb 2004 04:47
I feel kind of retarded asking this question, and it's a little off topic. When you MAKE FINAL on DarkBASIC Classic, does it include all the code you've #included?

Juvenile Industries
Current Project: KillZone(FPS)
Soon to come:An rts, and a snowball fight game

Login to post a reply

Server time is: 2024-09-21 21:06:19
Your offset time is: 2024-09-21 21:06:19