Welcome Guest.   Make a donation to an author on the site November 23, 2014, 06:06:20 PM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
View the new Member Awards and Badges page.
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: Problems with LCC-WIN32 compiler produced outputs  (Read 2881 times)
SkyIDE
Honorary Member
**
Posts: 244


View Profile Read user's biography. Give some DonationCredits to this forum member
« on: January 24, 2007, 03:33:27 AM »

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:


[copy or print]
#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.




« Last Edit: January 24, 2007, 03:54:19 AM by SkyIDE » Logged
Ruffnekk
Honorary Member
**
Posts: 331



Uhm yeah...

View Profile WWW Give some DonationCredits to this forum member
« Reply #1 on: January 24, 2007, 04:04:57 AM »

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

[copy or print]
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:

[copy or print]
#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  ohmy
Logged

Regards,
RuffNekk

Programming is an art form that fights back.
f0dder
Charter Honorary Member
***
Posts: 8,774



[Well, THAT escalated quickly!]

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #2 on: January 24, 2007, 04:12:30 AM »

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.
« Last Edit: January 24, 2007, 04:18:51 AM by f0dder » Logged

- carpe noctem
Ruffnekk
Honorary Member
**
Posts: 331



Uhm yeah...

View Profile WWW Give some DonationCredits to this forum member
« Reply #3 on: January 24, 2007, 04:13:43 AM »

LMAO, that *could* be the source of the problem here then  thumbs up
Logged

Regards,
RuffNekk

Programming is an art form that fights back.
SkyIDE
Honorary Member
**
Posts: 244


View Profile Read user's biography. Give some DonationCredits to this forum member
« Reply #4 on: January 24, 2007, 04:29:18 AM »

Yes, sometimes I got exceptions too or it will just freeze.
Logged
SkyIDE
Honorary Member
**
Posts: 244


View Profile Read user's biography. Give some DonationCredits to this forum member
« Reply #5 on: January 24, 2007, 04:35:44 AM »

Aha! It works! I just did "lcclnk test.obj" and voila! Thanks f0dder!

By the way, I had to change the code to printf("test") instead of cout, it's having problems with it. But yeah, as far as I know, LCC has a limited C++ support.

Thank You!

Hmmm now I have to modify some code......
« Last Edit: January 24, 2007, 04:39:39 AM by SkyIDE » Logged
Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.028s | Server load: 0.22 ]