ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

Problems with LCC-WIN32 compiler produced outputs

(1/2) > >>

SkyIDE:
Hi,

The support for LCC-WIN32 is fully completed but after all the work I did, I just realised the compiler might be buggy. It's either me doing something wrong or it is the compiler itself.

I have a simple code:



--- ---#include <iostream.h>




int main()
{

int iVar = 0;
cout << "Simple LCC C++ Program\n";

for (int i = 0; i < 1000; i++)
cout << "Looping\n";


return 0;

}

Filename test.cpp

I use "lcc test.cpp -FoC:\test.exe"
You can also use "lcc test.cpp -o C:\test.exe" which is the standard

The problem is, the exe file is produced BUT the program does not run. When you type C:\test.exe it just starts and exits instantly without producing any output. I have completely no idea why it does this. Their web site is:

http://www.cs.virginia.edu/~lcc-win32/

I didn't see any -l(inking) options. I was hoping I will find something but nothing.




Ruffnekk:
I reproduced the scenario copying and pasting your source code. When I run c:\test.exe it throws an exception:


--- ---C:\WINNT\system32\cmd.exe - c:\test.exe
The NTVDM-CPU has encountered an illegal instruction.
CS: 0728 IP:010c OP:0f 00 00 00 00 Click Close to exit the application

I doesn't matter which option I use to compile it.

If I change the code to:


--- ---#include <iostream.h>

int main()
{
cout << "Simple LCC C++ Program\n";
return 0;
}

then the program executes but freezes the command prompt...

Finally if I use -ansic or -pedantic switch I get a lot of warnings about obsolete code conventions. I'm not a C++ programmer, so that may be an issue here, but I can't tell you why  :o

f0dder:
Hrm, has LCC-win32 finally added C++ support?

Last time I looked it was purely C, so I wonder how the above even compiles...

EDIT: hm, seems like LCC has some limited support for iostreams like stuff, even though it doesn't do C++?

Anyway, your problem (hinted by NTVDM error, which is something you get for DOS apps) is that LCC produces object file output, not executables - you need to manually link. Using "-Fo" just changes the name, not the contents, and windows then interprets the .exe (which is really a COFF object file) as a DOS .com app.

Ruffnekk:
LMAO, that *could* be the source of the problem here then  :up:

SkyIDE:
Yes, sometimes I got exceptions too or it will just freeze.

Navigation

[0] Message Index

[#] Next page

Go to full version