i have a error in c graphics "segment exceeds _TEXT 64K" i reduce some lines but i have no solution

please help me as soon as possible

i want to complete my program as soon as possible

please help me some one

Dani AI

Generated

Short, practical explanation and fixes

The linker message "segment exceeds _TEXT 64K" means the program's code (the _TEXT/code segment) has grown past the 64 KB limit imposed by 16‑bit DOS-era toolchains and linkers. That limit is a fundamental artifact of 16‑bit segmented addressing, not a bug in your logic. (scribd.com)

If you must keep using Turbo C or another 16‑bit compiler, try these concrete fixes (they are ordered from easiest to more invasive):

  • Break the single huge source into multiple .c/.obj files so the compiler/linker can place code in separate segments (each translation unit is limited independently).
  • Move large read‑only tables or many long string literals out of headers and into their own module so they do not bloat the code segment.
  • Try a different 16‑bit memory model or compiler switches that place big static data into far segments (some compilers offer options such as /Gt or -Ff to force large items out of DGROUP).
  • If supported, use compiler pragmas to put groups of functions into named code segments (for example, pragmas like code_seg/alloc_text) so the linker won’t combine everything into one _TEXT segment. Check your compiler manual for the exact pragma/switch names. (scribd.com)

About your system() tests: system() hands its string to the platform command interpreter (COMSPEC). A program compiled as a DOS/16‑bit EXE (Turbo C) cannot reliably invoke modern 32‑bit Windows APIs or tools such as rundll32 for power management. To run Windows commands or call SetSuspendState you need a Win32/64 build (modern compilers use a flat memory model and remove the 64K code‑segment limit). As recommended, moving to a modern toolchain is the clean long‑term solution; is also correct that Turbo C cannot invoke current Windows services directly.

Quick checklist: split large files, move big tables out of code, try a larger memory model or compiler option, use code‑seg pragmas if available — otherwise port to a 32/64‑bit compiler.

Recommended Answers

All 10 Replies

Well the easy answer is to upgrade to a 32-bit compiler for your modern OS, then you get 2GB segments, not 64K segments.

But I'm guessing you're stuck with stone age tools from a stone age educational system.

The answer (if you can call it that) is to NOT have all your code in one singularly massive .c file. There's more to it, but it might be enough of a clue. Someone else will have to expand on this, or I might get around to it later on.

i am sachin chandora from abohar
thankes salem
can you tell me download site about this compiler

what compiler? Code::Blocks and vc++ 2010 Express are both free.

but tell me download site Ancient Dragon

i have a other problem that system() function can not working

i make a program to execute dir command of dos as:

#include<stdlib.h>
#include<process.h>
#include<conio.h>
main()
{
   system("dir");
   getch();
}

i also make a program to do hibernet the computer but these code are not working

can you tell me that how can i use system() function in c compiler

#include <stdio.h>
    #include <conio.h>
    #include <process.h>
    #include <stdio.h>

    main()
    {
    char x;
    printf("Enter any character");
    scanf("%c",&x);
    if (x==65)
    {
    system("C:\\WINDOWS\\SYSTEM32\\rundll32.exe PowrProf.dll, SetSuspendState");
    }
    }

: How does the link here 'from a stone age educational system.' help the OP and why did you think it was needed to be shared on this forum ? You didn't need to share it because every student in india knows this, there are a lot of factors behind these things but people like the OP are still trying to learn instead of crying about what kind of teachers/facilities they have or don't have.
Daniweb didn't use to be a place where we tried to show our biases. I can find a hundred articles about problems in educational systems in almost every country in this world so every time someone asks a question should I first tell them that their education system sucks ?

commented: Exactly and most Education systems don't lack in compilers they simply lack in knowledge of the OSF and GNU projects ;P +3

i also make a program to do hibernet the computer but these code are not working

can you tell me that how can i use system() function in c compiler

That can not be done from Turbo C. You have to use a modern 32 or 64 bit compiler such as Code::Blocks or VC++ 2010 Express to access MS-Windows programs. The best you can do from Turbo C is to run old MS-DOS commands.

> You didn't need to share it because every student in india knows this
Did you read the link at all?

Because apparently most of them don't know the system sucks until the point they actually try to FIND A JOB. It's only then that they find out they've wasted 3 or 4 years of time and money for some toilet paper.

Using TurbidCrap isn't a preserve of just India either, there are schools all over the world still using it.

Apparently "help" for you means spoon-feed the immediate answer so they can go away and get a useless grade and "be happy" (for a while at least).

If enough students read the link, create enough "pressure" for change within the system by demanding an education fit for purpose, then change might actually happen. At any rate, the smart ones will take it upon themselves to seek alternatives to make sure they're well positioned in the job market.

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.