I am writing a DOS screen football game(No graphics), I have reached 61,283 lines any bigger than this I get a error that says linker warning, exceeded memory limit for block line cache in module. Old compiler version 4.0.

Recommended Answers

All 20 Replies

Try using a new compiler. In Windows both Visual Studio and Code::Blocks have free C++ ide's with up to date compilers.

Also have you tried optimizing your code? Especially look for redundant blocks that can be put into a function.

Thank you tinstaffl

There are certainly redundant blocks of code that I can "Clean up" but I will need a bigger program for Offensive plays. Right now I am finishing up special teams. My new computer is a 64 bit system. and it puts the compiler in a x86 folder. all my previous computers were 32 bit. Is there a limit that I will ne ed to work around or "under". I did install just now a Borland 6.0 version but same linker error shows up.

Thank you steve

What new compiler did you install? Visual Studio will compile both 32 and 64 bit programs, its just an option change. The compiler itself is a 32 bit compiler and is always installed in the Program Files (x86) folder.

Is your entire program contained within just one *.cpp file? If you still want to use those old 16-bit compilers then try splitting the program into more than one file -- Turbo C++ probably attempts to put everything in the same *.cpp file into the same segment, depending on the memory model used. If you use the large or huge memory models then you can have bigger programs, assuming the program consists of two or more *.cpp files.

Thank you Ancient dragon I just installed Borland C++ builder version 6 "personal" and yes it is all one file. I will try to "split it" and I will als o try to elimanate redundant code along with statements I use to debug. I assume I am limited in how big one*.ccpcan be

thank you steve

The limit only applies to old 16-bit compilers, and I think the compiler you installed is like that. Why don't you install either Code::Blocks with MinGW compiler or Visual Studio 2013 Express (both are free).

Thank you Ancient dragon I guess I will do what you suggest.

I will post when I have done so.

Steve

Ancient dragon

I installed Visual studio, and now I have to relearn programming.
cout,cin,endl are no longer supported. I couldnt even get hello world to work.

where does one start

PS This is the first ime I have used visual C++

cout,cin,endl are no longer supported

Really? I suspect that actually, your code is wrong. Alternatively, you've not told it you're trying to code in plain C++ (Visual Studio supports many languages). Possibly you're learning C++ from before 1990 and you're not using namespaces. Let's see your code.

#include <iostream>
#include "stdafx.h"
using namespace std;
//extern ostream; cout;
void main()


    {


    std::cout<< "Enter string to copy \n";
    cout << "Enter string to copy \n";


    }

This is what I have in Visual studio C++ 2013
Is Visual C++ different from "Regular" C++ I also am beginning to mis the black screen

Visual C++ is just the name of a software tool released by Microsoft.

That code would be better written as this:

include <iostream>
using namespace std;

int main()
{
cout<< "Enter string to copy \n";
}

but apart from the void main() (main returns int, always), it's correct C++ code.

Did you choose a Win32 Console program? http://msdn.microsoft.com/en-us/library/ms235629.aspx

I will have to check Win32 console part

Thank you steve

I did use Win32 console, but I did the second time, and I still get errors.
Errors C4430
and C2059,C2065

The IDE should have told you what those error numbers mean and on which line they occur. We can't tell you much about them unless you post the complete code. google for the error numbers and you will find more detailed information about the errors.

If you don't turn off precompiled headers stdafx.h must be the first include in the program -- no other includes can appear before that one. With precompiled headers option turned on you MUST includer stdafx.h, you can't delete it or the compiler will error out. The option to turn precompiled headers on or off is given when you first create the project, but you can do this later after the project has been created if you want to.

How to turn off precompiled headers
In VS++ 2013, select menu Project --> Properties (last item in the list)
Expand Configuration Properties tab
Expand C/C++ tab
Select Precompiled Headers
on the right side of the window select the first item, Precompiled Header and change it's option to Not Using Precompiled Headers

901557570341da0634fcdb0ac5c8ee5e

Also, if you don't turn off UNICODE then the compiler will assume you want to use UNICODE style strings, instead of char* you will have to use wchar_t*. This affects both string literals and character arrays. If you are not interested in languages other than English, then I suggest you turn off UNICODE, especially when first learning programming.

How to turn UNICODE off

In VS++ 2013, select menu Project --> Properties (last item in the list)
Expand Configuration Properties tab
select General
On the right side of the window scroll down and find Character Set and change the selection to Not Set

9beb9eb88b7bdf203dc05ca63af25a58

It worked

#include "stdafx.h"
#include "iostream" // no .h
using namespace std:
void main
{
  std::cout << "Enter string to copy "<< std::endl;
}

You have to turn debugging off then you get the DOS screen
and yes I found all the errors online this did help alot.
Thank you ancient dragon for your detailed help It must have taken alot of time.

I now have to relearn a whole new subject.
I will marked this as solved tomorrow.

Thanks again Steve

Visual Studio want angle brackets, not quotes, around the names of standard c++ and VS header files

#include <iostream>

void main

it's int main(), never void main() because main() always returns an integer back to the operating system.

it's int main(), never void main() because main() always returns an integer back to the operating system.

Except when the program is freestanding and not hosted by an operating system. But if you're writing a freestanding program, you're probably not asking for help on a place like Daniweb. ;)

Actually, Deceptikon, this is one place where C and C++ part ways; the C++ standard does require and int return value, and always has, whereas the older C standard recommends but does not enforce it.

IIUC, the C11 has changed this to require an int return as well, even on systems where it isn't needed (presumably, the compiler simply discards it, in those cases). Can anyone confirm or deny this?

C++11 (3.6.1 Main Function)

"A program shall contain a global function called main, which is the designated start of the program. It is implementation-defined whether a program in a freestanding environment is required to define a main function. [Note: In a freestanding environment, start-up and termination is implementation-defined; startup contains the execution of constructors for objects of namespace scope with static storage duration; termination contains the execution of destructors for objects with static storage duration. —end note ]"

In other words, all bets are off in a freestanding environment. main can be required or not, and by extension, the signature defined for hosted environments is not required either.

Through a loophole in the wording, the C standard (up to and including C11) allows void main in a hosted environment provided int main is also supported. There too, all bets are off for freestanding environments. I'm not sure about C14 though, I haven't been keeping up with the bleeding edge of standardization.

Ah, thank you for the correction.

Thank you all for your kind help

Steve

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.