views:

1693

answers:

7

I am trying to run Cygwin, and I am running into some problems. I tried to compile a program that works both on Windows with mingw and on a Unix system, but when I go to compile it through Cygwin:

gcc threads.c -o threads

I get the error: this application has requested the runtime to terminate it in an unusual way

And that's it... any ideas what I am forgetting or screwing up? I haven't touched this stuff in about 5 years so I am beyond rusty; thanks!

A: 

Assuming you are compiling threads.c which I would gather has something to do with threads, have you tried this...

gcc -L libthreads -o threads threads.c

This is telling the gcc compiler to include the library threads and link it together.

Or... you could include the switch into the above command line -mno-cygwin if you don't need the unix-like behaviour.

Hope this helps, Best regards, Tom.

tommieb75
No, -L does not give gcc the name of a library to link to your program. It adds the following parameter to the list of directories it looks at to find such libraries. You mean -lpthread. Not that that explains why the compiler is crashing.
Warren Young
A: 

That sounds to me like Windows is having some sort of problem running gcc itself, not any problem with your code.

Check out the information from Microsoft here and see if it might fit your situation. I know it says Visual C++ 6, but it might be related.

bde
+2  A: 

The error message means the compiler crashed while trying to build your program.

Most likely this means your Cygwin installation is corrupt or happens to include a broken version of gcc. Try updating to the current version of Cygwin. This is doubly the case given that Cygwin 1.7 and the first stable releases of GCC 4 are both recent happenings. If you're still on Cygwin 1.5 or GCC 3.x, I think there's an excellent chance that upgrading will fix your symptom.

Warren Young
+4  A: 

In my case this problem was caused by the fact I didn't have a TEMP environment variable defined in cygwin, try:

export TEMP=/tmp

If TEMP is already defined make sure the directory is not read only.

George Norton
in my case, defining TEMP fixed this issue too
RogerV
A: 

export TEMP=/tmp

worked for me also

Falconx
A: 

TEMP worked for me also. Latest Cygwin and MinGW on Win7. mingw32-g++ crashes compiling any source if TEMP is not set.

Tam Toucan
A: 

export TEMP=/tmp

worked for me as well when I encountered the same error message running mingw32-gcc under cygwin on windows 7.

Matthew S