Support > General Discussions

? about compiling C code produced with ScriptBasic

<< < (4/5) > >>

Support:
You can find the Windows gcc (TDM) version that Armando (AIR) did in the downloads section of the forum.

GSAC3:
John:

After searching through nearly all of the forum messages in the DOWNLOAD section, I am unable to find an example of how to produce a "small footprint", standalone EXE using GCC.  The example you provided in your SB2C message thread is for LINIX, not WINDOWS XT.  I have been trying, unsuccessfully, for several days now to produce a WINDOWS version of what you did under LINIX.

If you have your WINDOWS XP box working now, can you provide a clear example for WINDOWS like you did for LINIX?

Don


Don

Support:
This worked for me. I recompiled the current Script BASIC 2.2 source with TDM-GCC-32 and attached a zip with binaries needed to compile to C.  Let me know if you run into any problems.


C:\sb22\test>type 4next.sb
FOR x = 1 to 5
  PRINT x,"\n"
NEXT x

C:\sb22\test>scriba -Co 4next.c 4next.sb
C:\sb22\test>gcc -Os 4next.c -I \sb22\source C:\TDM-GCC-32\lib\sb.a -lscriba -lm -lpthread -lws2_32 -ladvapi32 -o 4next
C:\sb22\test>4next
1
2
3
4
5

C:\sb22\test>dir 4next.*
 Volume in drive C has no label.
 Volume Serial Number is 1415-F200

 Directory of C:\sb22\test

10/16/2014  05:32 PM             2,619 4next.c
10/16/2014  05:32 PM            42,505 4next.exe
10/16/2014  05:25 PM                40 4next.sb
               3 File(s)         45,164 bytes
               0 Dir(s)  67,840,901,120 bytes free

C:\sb22\test>

GSAC3:
John:

Thanks for the sample GCC compile setup.

I am having a little trouble with the GCC compile, however.  I put the new BIN and LIB subdirectories in my SB22b2 installation, and when I try my TEST sample using the command line sequence below --

scriba -Co TEST.c TEST.sb

gcc -Os TEST.c -I G:\sb22\source G:\MinGW32\lib\sb.a -lscriba -lm -lpthread
-lws2_32 -ladvapi32 -o TEST

The GCC compile above returns two error messages:

“can’t find –lscriba"  and “can’t find –lpthread”

I know I must be doing something wrong but I don't know what.
Where are or should lscriba and lpthread be located?
I am using MinGW32 version 4.9.1.

Don

Support:
libscriba.a and sb.a go in  your MinGW32 lib directory.

If your Script BASIC bin directory is in your search path, you can put your libscriba.dll in there. You need to point to the Script BASIC source headers with the -I command line argument. Look in the MinGW32 lib directory for a libpthread????.a and adjust your command line with the proper filename.

Make sure you're using the MinGW32 shell or have run the .bat script in a standard shell to setup the environment.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version