GLBasic forum

Main forum => GLBasic - en => Topic started by: mentalthink on 2009-Dec-12

Title: C++ in GLbasic
Post by: mentalthink on 2009-Dec-12
Hi, there.

After a time using GLBASIC, (itÃ,´s wonderful), I wish add code in C++ because I want to learn this lenguaje too.
My fisrt dout about to implement C++ on GLbasic, is, how Can make a #include, Ex (Stdio.h)?Ã,¿

I put a little code  like this.

//the code donÃ,´t make nothing only increment a var a (I think...)
WHILE TRUE
INLINE
   
         #include <stdio.h> //this dont work
   
   int a;
   a++;
         ENDINLINE
SHOWSCREEN
WEND

the file.h, I think is called library or headers, is added to source code of my code, but when I try to compile, GLbasic tell me an error about the .h file added.

Another question, I can make anything in c++ into glbasic.?Ã,¿

Thanks, best regards, and happy Christmas!!! for all members of GLB forum

Best Regards,
mentalthink
Title: Re: C++ in GLbasic
Post by: namco on 2009-Dec-12
See the Requre and Import functions in the help file (F1).
Title: Re: C++ in GLbasic
Post by: MrTAToad on 2009-Dec-12
#Include works fine, but only seems to look in the directory that the project is in - which is a problem at times.  You need to download the platform header files to use stdio.h

You can use extern "C" to get access to most stuff, or you can use REQUIRE, IMPORT or the DLL call functions
Title: Re: C++ in GLbasic
Post by: mentalthink on 2009-Dec-12
 Thanks MrTAToad, always give a good answer.

Thanks again.

Best Regards.
Title: Re: C++ in GLbasic
Post by: Schranz0r on 2009-Dec-14
First you have to create a new file on your Project ( right window on your IDE -> Files -> Rightclick on the window -> new file )

Then you have to close the GLBasic-Namespace, and then you can include files ;)


Code (glbasic) Select

INLINE
}  // Close the GLBasic-namespace


#include <stdio.h>


namespace __GLBASIC__{ // restore GLBasic-namespace
ENDINLINE