Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • August 31, 2015, 12:46:53 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Problems with LCC-WIN32 compiler produced outputs  (Read 3238 times)

SkyIDE

  • Honorary Member
  • Joined in 2006
  • **
  • gravatar avatar
  • Posts: 245
    • View Profile
    • Donate to Member
Problems with LCC-WIN32 compiler produced outputs
« 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:


Code: [Select]
#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 »

Ruffnekk

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 332
  • Uhm yeah...
    • View Profile
    • RuffNekk's Crypto Pages
    • Donate to Member
Re: Problems with LCC-WIN32 compiler produced outputs
« 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:

Code: [Select]
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:

Code: [Select]
#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
Regards,
RuffNekk

Programming is an art form that fights back.

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 8,858
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Donate to Member
Re: Problems with LCC-WIN32 compiler produced outputs
« 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.
- carpe noctem
« Last Edit: January 24, 2007, 04:18:51 AM by f0dder »

Ruffnekk

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 332
  • Uhm yeah...
    • View Profile
    • RuffNekk's Crypto Pages
    • Donate to Member
Re: Problems with LCC-WIN32 compiler produced outputs
« Reply #3 on: January 24, 2007, 04:13:43 AM »
LMAO, that *could* be the source of the problem here then  :up:
Regards,
RuffNekk

Programming is an art form that fights back.

SkyIDE

  • Honorary Member
  • Joined in 2006
  • **
  • gravatar avatar
  • Posts: 245
    • View Profile
    • Donate to Member
Re: Problems with LCC-WIN32 compiler produced outputs
« Reply #4 on: January 24, 2007, 04:29:18 AM »
Yes, sometimes I got exceptions too or it will just freeze.

SkyIDE

  • Honorary Member
  • Joined in 2006
  • **
  • gravatar avatar
  • Posts: 245
    • View Profile
    • Donate to Member
Re: Problems with LCC-WIN32 compiler produced outputs
« 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 »