Author Topic: Multiple sources (SOLVED!)  (Read 2763 times)

Offline ampos

  • Prof. Inline
  • *****
  • Posts: 1600
    • View Profile
    • AMpostata Website
Multiple sources (SOLVED!)
« on: 2010-Oct-04 »
For faster compiliong time, it has been said to split the program in multiple sources files in the same proyect, as the compiler only compiles the sources that has changed.

I think I read somewhere how to do that, but I dont remember.

And I dont remember how to incluse/call SUBs or FUNCTIONs in a different source file.

Any help?
« Last Edit: 2010-Oct-05 by ampos »
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

Offline Moebius

  • Dr. Type
  • ****
  • Posts: 315
    • View Profile
Re: Multiple sources
« Reply #1 on: 2010-Oct-04 »
See http://www.glbasic.com/xmlhelp.php?lang=en&id=256&action=view for the GLB manual on adding multiple files to your project.
You just need to use the 'Files' tab in the sidebar in the editor.
All functions and subs in included files should be able to be called by your program from what I know, just call them as usual.
Also, I think using types from other source files now works in the later updates.  Don't trust me on this one though.
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
- Random Shack Data Processing Dictionary

Offline Cliff3D

  • Dr. Type
  • ****
  • Posts: 268
    • View Profile
Re: Multiple sources
« Reply #2 on: 2010-Oct-04 »
I am using an extended type (and several non-extended types) that are in a secondary source file in my 3D .OBJ project. It seems to work just fine despite issuing a few minor "false warnings" at compile time.

Offline ampos

  • Prof. Inline
  • *****
  • Posts: 1600
    • View Profile
    • AMpostata Website
Re: Multiple sources
« Reply #3 on: 2010-Oct-04 »
I tried making a 2nd source window on my proyect, and making a cut&paste from main to this 2nd source, but compiler gives me an error...
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

Offline ampos

  • Prof. Inline
  • *****
  • Posts: 1600
    • View Profile
    • AMpostata Website
Re: Multiple sources
« Reply #4 on: 2010-Oct-05 »
Find:

You can create and save a document/source/window in the proyect, but you have to add the saved document/source in the right window "files" to tell BLG to use it as a "source file to be compiled"
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

Offline Cliff3D

  • Dr. Type
  • ****
  • Posts: 268
    • View Profile
Re: Multiple sources (SOLVED!)
« Reply #5 on: 2010-Oct-06 »
Yes - although IIRC there's another way to do it, IMHO it's frustrating that GLBasic very much expects you to add an existing file to a project to make it part of a multiple-source project rather than creating multiple sources yourself during the lifetime of the project. It also assumes that new source files created ar eNOT part of the current project automatically, something I consider a flaw and have previously mentioned :(

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10851
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: Multiple sources (SOLVED!)
« Reply #6 on: 2010-Oct-06 »
you can right click on any file in the editor (text editor) and select: Add to project (if it's not already in).
You can make a new file in the files tab, or you can also add existing files there.
I'll try to support drag/drop in the next update.

Offline ampos

  • Prof. Inline
  • *****
  • Posts: 1600
    • View Profile
    • AMpostata Website
Re: Multiple sources (SOLVED!)
« Reply #7 on: 2010-Oct-06 »
And why not add it to the current project when you choose "create new file"? What sense has to create in a project a new file that is not part of the project?
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10851
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: Multiple sources (SOLVED!)
« Reply #8 on: 2010-Oct-06 »
You mean File/Source/New? That's stupid. Thanks for noticing.