This may help:
http://stackoverflow.com/questions/2...latform-manner |
|
Quote:
--- rod. |
thanks but i still don't get the code in lang c++...
|
Quote:
And you never really said what you want. Do you want to: Be able to draw stuff (not limited to text) in a graphical window --- OR --- Be able to change the color of text printed to a terminal? Those are very different, unrelated things and require completely different answers. |
Quote:
|
Lots of people have tried to help you. We need more information, and we have asked you specific questions that you can answer to give us that information. You gave us
Quote:
--- rod. |
You've already been given enough resources that you can write the code yourself. You use ncurses or s-lang for the cursor position and stuff, and ANSI escape sequences for the colors. Yes this requires you to read the links that were previously posted. And no, we're not going to write it for you.
|
When i here graphics in "c" i think of
Cimg.h a very nice lib ( built at compile) |
Quote:
whenver i try to complie on of the tutorial program they have given in that site.. error occurs that is p2.cpp:3:19: fatal error: CImg.h: No such file or directory compilation terminated. the code is #include <Cimg> using namespace cimg_library; int main() { CImg<unsigned char> image("lena.jpg"), visu(500,400,1,3,0); const unsigned char red[] = { 255,0,0 }, green[] = { 0,255,0 }, blue[] = { 0,0,255 }; image.blur(2.5); CImgDisplay main_disp(image,"Click a point"), draw_disp(visu,"Intensity profile"); while (!main_disp.is_closed() && !draw_disp.is_closed()) { main_disp.wait(); if (main_disp.button() && main_disp.mouse_y()>=0) { const int y = main_disp.mouse_y(); visu.fill(0).draw_graph(image.get_crop(0,y,0,0,image.width()-1,y,0,0),red,1,1,0,255,0); visu.draw_graph(image.get_crop(0,y,0,1,image.width()-1,y,0,1),green,1,1,0,255,0); visu.draw_graph(image.get_crop(0,y,0,2,image.width()-1,y,0,2),blue,1,1,0,255,0).display(draw_disp); } } return 0; } i tried the same code with c complier .it didn't work |
#include <graphics.h>
#include <stdlib.h> #include <stdio.h> #include <conio.h> #include<iostream.h> int main(void) { /* request auto detection */ int gdriver = DETECT, gmode, errorcode; int left, top, right, bottom; /* initialize graphics and local variables */ initgraph(&gdriver, &gmode, ""); /* read result of initialization */ errorcode = graphresult(); if (errorcode != grOk) /* an error occurred */ { printf("Graphics error: %s\n", grapherrormsg(errorcode)); printf("Press any key to halt:"); getch(); exit(1); /* terminate with an error code */ } cout<<endl<<endl<<endl<<" zxc HOSPITAL" <<endl<<endl<<" name-abc age-56 "<<endl<<endl<<" reg no-907 Dr name-mno"<<endl; left = getmaxx() / 2 - 200; top = getmaxy() / 2 - 200; right = getmaxx() / 2 + 200; bottom = getmaxy() / 2 + 200; /* draw a rectangle */ rectangle(left,top,right,bottom); /* clean up */ getch(); closegraph(); return 0; } i am tring to convert this code for fedora but i quite get stuck at few things conio should be replaced with what. graphics.h doesn't work what should be done for that? |
slang..tried to use that... but same kind of error...
fatal error what should b done? |
List out here the errors you get when you remove conio.h and then compile.
|
Quote:
-- or --- and give the full or relative PATH to it in the source folder every example in the "examples" ( for the examples the relative path would be " ../ " ) folder uses that "Makefile" to build all of them Code:
make MLinux |
Quote:
pasted that in /usr/include.but still the program shows the same error |
All times are GMT -5. The time now is 05:12 PM. |