Installed MingW, can no longer build project

BlitzMax Forums/BlitzMax Programming/Installed MingW, can no longer build project

ReconditePhreak(Posted 2015) [#1]
I'm futzing around with a simple tetris clone and decided to see about getting the C compilation stuff working.

I installed the mingw compiler from here: http://www.mingw.org/.

Installed to C:\MingW

Pointed Blide at the directory and it claimed to have found GCC.

I then went to modules->build all modules and everything appeared to build just fine. However, when I attempt to build my project I get the following error


C:/BlitzMax/mod/pub.mod/stdc.mod/stdc.debug.win32.x86.a(stdc.c.debug.win32.x86.o):stdc.c:(.text+0x3a9): undefined reference to `__mingw__wopendir'
C:/BlitzMax/mod/pub.mod/stdc.mod/stdc.debug.win32.x86.a(stdc.c.debug.win32.x86.o):stdc.c:(.text+0x3e6): undefined reference to `__mingw__wclosedir'
C:/BlitzMax/mod/pub.mod/stdc.mod/stdc.debug.win32.x86.a(stdc.c.debug.win32.x86.o):stdc.c:(.text+0x3f9): undefined reference to `__mingw_closedir'
C:/BlitzMax/mod/pub.mod/stdc.mod/stdc.debug.win32.x86.a(stdc.c.debug.win32.x86.o):stdc.c:(.text+0x41b): undefined reference to `__mingw__wreaddir'
C:/BlitzMax/mod/pub.mod/stdc.mod/stdc.debug.win32.x86.a(stdc.c.debug.win32.x86.o):stdc.c:(.text+0x44c): undefined reference to `__mingw_readdir'
Build Error: Failed to link J:\blitz-max\tetris\Tetris\Main.debug.exe

I *think* these functions are from dirent.h, has anyone ran into this issue before? How would I go about resolving this, I'm so in the dark with respect to Blitz Max's build system that I'm not really sure where to go from here.


virae(Posted 2015) [#2]
Kind of funny, I ran into this exact problem just now.

I cannot offer you a solution, but a temporary workaround:
Now that you have your modules all built, re-install Blitzmax to the same location it currently sits in without removing your current installation. This is what currently works for me.

Just for error tracing: This happened under Win 8.1, latest Blitzmax and MinGW gcc at version 4.8.1. Visual Studio is installed too, not sure if that could be a problem.


virae(Posted 2015) [#3]
Oh, and I was trying the whole thing with IndevIDE and MaxIDE; So the problem does not depend on the IDE in use.


H&K(Posted 2015) [#4]
http://www.blitzbasic.com/Community/posts.php?topic=104190#1260742

Use MinGW 4.5.2
http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/Previous/1.1006.0/

And use the search option.


ReconditePhreak(Posted 2015) [#5]
For those that come across this, you need to install the 32-bit version.

Can we get the thread about installing mingw updated?


Grisu(Posted 2015) [#6]
I got 4.8.1 working, but no luck with 4.9.2 so far.

There are guides, but most are outdated.


grable(Posted 2015) [#7]
For 4.9.1 (and 4.9.2) i had to compile BRL.AppStub first, then the rest was ok.
But i allso had some issues with memory allocation.. Had to add a seemingly pointless null check to MemExtend or ot would crash in the runtime startup.


Grisu(Posted 2015) [#8]
That's what happened to me. All apps crashed at startup.

Would be great to have some file templates for the main GCC versions. This way users could more easily make use of a new compiler.

Still dreaming of a BMX 64Bit-Edition...


grable(Posted 2015) [#9]
Grisu: I have not had any other problems after adding that null check though.

If your not afraid of patching brl.blitz this is all you need (in file blitz_memory.c):
void *bbMemExtend( void *mem,int size,int new_size ){
	void *p;
	p=bbMemAlloc( new_size );
	if(mem) {
		bbMemCopy( p,mem,size );
		bbMemFree( mem );
	}
	return p;
}



Grisu(Posted 2015) [#10]
^ Thanks for the code Grable.

I felt like a surgeon when I added these lines to the bmx core function.
But the patient is alive and healthy... :)