I got it working , can someone please delete my attached files to avoid plagiarism
Printable View
I got it working , can someone please delete my attached files to avoid plagiarism
................. working
Vista like to spring this kinda stuff on me all the time :'(Quote:
it says permission denied
If these are just warnings maybe I can still run it ?
Please help , I have no idea how to get it working .....
This looks odd to me, and apparently your compiler too. I don't have your header.Code:int (*Image_invert(int image_data[EP100_LIB_MAX_X][EP100_LIB_MAX_Y]))[]
Header ? Do you mind checking the Image.c file , I' m not able to post the contents now , the network is clogged up at uni , and I can't even get terminal to open .
Without it, my compiler complains differently.Code:#include "ep100lib.h"
The header is present in both Image.c and the Image_lib.c ??
To you.
If you are asking folks here to make stuff up and guess how to help, it makes for a long and difficult journey.
Then again, I'm off my game again lately.
Uhm I just don't know how to solve my errors . I gave you all the information I can .
Image.c contains this line
#include "Image_lib.c"
It should be written as
#include "Image_lib.h"
Where Image_lib.h is a new file containing
Image_lib.c should also include this file as well.Code:#ifndef IMAGE_LIB_INCLUDED
#define IMAGE_LIB_INCLUDED
#define EP100_LIB_MAX_X 1024
#define EP100_LIB_MAX_Y 1024
int (*Image_invert(int image_data[EP100_LIB_MAX_X][EP100_LIB_MAX_Y]))[];
// A procedure that will scroll an image horizontally and return back into matrix
void Image_horizontal_scroll(int image_data[EP100_LIB_MAX_X][EP100_LIB_MAX_Y], int scroll, int height, int width);
// A procedure that will scroll an image vertically and return back into matrix
void Image_vertical_scroll(int image_data[EP100_LIB_MAX_X][EP100_LIB_MAX_Y], int scroll, int height, int width);
#endif
After that, your scroll functions need looking at because I don't think they're returning the modified result.
The EP100... constants should really come from teh EP100 lib file, if I've understood the other thread.
But the halucinogenic drugs influencing the teacher is springing up again: Apparently, the students have been told to create TWO source files, one main and one which contains the image_invert. So an extra header file is (from what I understand) not allowed... Stupid rules - I can understand rules that say "You can't use this library function, because you should be implementing it yourself". But I don't see the point of teaching really bad habits.
--
Mats
>I got it working , can someone please delete my attached files to avoid plagiarism
Don't do that, what if someone else has the same or similar problem?
If you want to avoid plagiarism, don't post your code in the first place.
> So an extra header file is (from what I understand) not allowed... Stupid rules
This doesn't make any sense at all.
The way two .c files communicate is with a .h file. Yes there are ways around it, but none of them stack up as good long term solutions.
For example, one alternative is to leave your Image.c file "as is", and remove Image_lib.c from the makefile. So long as there is only ONE source file including another source file, then you can scrape by.
With about half a dozen of them all on the same course posting here, it's hard to figure out who we're talking to at times, and what they may (or may not) have learnt in the process.
Hi , thanks for the ep100lib.h file matsp . I ended up putting it at the top of Image.c , as we are only meant to submit 2 files , the Image_lib.c and Image.c ...
Now it looks like this :
I have gotten the image invert to work , now I have 11 hours or so to get the scrolling done .Code:#include <stdio.h>
#include <string.h>
#include "Image_lib.h"
#ifndef IMAGE_LIB_INCLUDED
#define IMAGE_LIB_INCLUDED
#define EP100_LIB_MAX_X 1024
#define EP100_LIB_MAX_Y 1024
int (*Image_invert(int image_data[EP100_LIB_MAX_X][EP100_LIB_MAX_Y]))[];
void Image_horizontal_scroll(int image_data[EP100_LIB_MAX_X][EP100_LIB_MAX_Y], int scroll, int height, int
width);
void Image_vertical_scroll(int image_data[EP100_LIB_MAX_X][EP100_LIB_MAX_Y], int scroll, int height, int
width);
#endif
int (*Image_invert(int image_data[EP100_LIB_MAX_X][EP100_LIB_MAX_Y]))[];
void Image_horizontal_scroll(int image_data[EP100_LIB_MAX_X][EP100_LIB_MAX_Y], int scroll, int height, int
width);
void Image_vertical_scroll(int image_data[EP100_LIB_MAX_X][EP100_LIB_MAX_Y], int scroll, int height, int
width);
int main(int argc, char **argv) ...
Just to clarify:
1. I didn't post that header file. I think that was Salem.
2. You don't need to use "include guards" if you are just putting a copy of the stuff IN the main file.
3. You have duplicate defintions of the same function - that will just confuse everyone.
--
Mats
> 3. You have duplicate defintions of the same function - that will just confuse everyone.
Believe me it's hard to be more confused than me right now . But I will try to fix :)
I have been trying to get putty / xwin32 working for the last hour but it seems as there is a proble with uni server . ANyone know how I can use my dmccompiler to compile it ?
I tried dmc make , which gives :
I think the problem is that the makefile is referencing a directory stored on uni servers , which contains a library , that I can't copy to my machine . Is there any way of checking it on windows ? Otrherwise there's no way to check what I have done ....Code:Do not know how to create Image.o
I presume "dmc" is a DOS/Windows compiler, and that the problem is that the makefile uses default rules to create the object files, hence the make utility for MS OS's don't know what you are asking it to do. Try changing all .o into .obj and see if that helps.
--
Mats
Code:FILE=Image
CFLAGS=-I. -I/usr/units/ep100/ass2.072/ `imlib2-config --cflags` -g
$(FILE): $(FILE).obj
Image_lib.obj
cc $(FILE).obj Image_lib.obj -o $(FILE) `imlib2-config --libs` -L/usr/units/ep100/ass2.072/
-lep100 -g
IMAGE=images/pa300570_small.jpg
PARAM=
run: $(FILE)
$(FILE) $(PARAM) $(IMAGE)
# DO NOT DELETE
Is that what you meant by changing it into .obj ?Code:C:\Users\Ben\dm\bin>make
Error: don't know how to make 'Image.obj'
That is indeed what I meant, but obviously not sufficient.
You may need to add:
I also think that this:Code:.c.obj:
cc -o ${CFLAGS} $@ $<
may not work right unless you've got a UNIX-like shell that this runs in - nor will the include path work very well.Code:CFLAGS=-I. -I/usr/units/ep100/ass2.072/ `imlib2-config --cflags` -g
--
Mats
Sorry matsp , I didn't know how to add the :
But I'm afraid that no matter what I do it will not work , as it needs a library that is in this folder :Code:.c.obj:
cc -o ${CFLAGS} $@ $<
/usr/units/ep100/ass2.072 .
I finally managed to get into it with putty.Code:13644637 % chdir /usr/units/ep100/ass2.072
13644637 % ls
ep100lib.h example_Image.c Image Image_lib.c Image_lib.o Image.o images libep100.a Makefile Makefile.bak oldlibep100.a
13644637 %
I guess that means there is no way to get that file on my computer . I triedbut that gives me a whole bunch of scrmbled up code...Code:vi libep100.a
Yes, using vi on a binary will do that.
Since the binary is for linux, you'll have to use the linux machine to build your files. You should be able to do that with putty - I've done that LOTS.
--
Mats
Yes but the problem is I don't have a graphical interface . So I have no idea what it's doing to my image . Unless somehow I can make an executable and then somehow send it to my computer ... Do you know a way to copy a file from putty to the computer's hard drive
Yes, in the putty package you should have pscp - look up "man scp" on the web, and pscp will work the same.
Gotta go home now.
--
Mats
Ok cheers , thank you very much for your help