I passed all 10 tests under vcc environment.
I tried to compile the assignment 1 on matrix account.
I use ssh to upload 3 files, test.c, ciol.c, ciol.h
I changed PLATFORM PLT_LNX in ciol.h.
I enter: gcc -o as1 test.c
I got a lot of error.
like this:
ciol.c:618: error: 'F7_KEY' undeclared (first use in this function)
ciol.c:619: error: 'F8_KEY' undeclared (first use in this function)
ciol.c:620: error: 'F9_KEY' undeclared (first use in this function)
actually, I have all the define in ciol.h
# if PLATFORM == PLT_LNX
#define UP 259
#define DOWN 258
#define LEFT 260
#define RIGHT 261
#define PGUP 339
#define PGDN 338
#define ENTER 10
I think I missed some steps before do the gcc -o as1 test.c
I didn't compile the ciol.c
How to compile all this under linux?
Thanks ahead.
Subscribe to:
Post Comments (Atom)
I found some mistakes, I put #define up 259, it should be UP_KEY 259.
ReplyDeleteI will change it and see if it works or not.
I fixed those define mistakes.
ReplyDeleteI use gcc -o as1 test.c ciol.c
I got some errors:
ciol.o: In function `io_init':
ciol.c:(.text+0x7): undefined reference to `initscr'
ciol.c:(.text+0xc): undefined reference to `noecho'
ciol.c:(.text+0x11): undefined reference to `cbreak'
ciol.c:(.text+0x16): undefined reference to `stdscr'
What did I miss?
Make sure you use Putty to run the program and change the "Terminal>Keyboard>The Function keys and keypad" setting in Putty to "Xterm R6".
ReplyDeleteThe line to compile on matrix is:
cc test1.c ciol.c -lncurses
Thanks for the reply.
ReplyDeleteI did it in putty.
I get this result:
/tmp/ccjRVE2E.o: In function `io_edit':
ciol.c:(.text+0x1de): undefined reference to `io_len'
ciol.c:(.text+0x21d): undefined reference to `io_len'
ciol.c:(.text+0x232): undefined reference to `io_len'
ciol.c:(.text+0x3b7): undefined reference to `io_len'
ciol.c:(.text+0x406): undefined reference to `io_len'
/tmp/ccjRVE2E.o:ciol.c:(.text+0x462): more undefined references to `io_len' follow
/tmp/ccjRVE2E.o: In function `io_edit':
ciol.c:(.text+0x4a1): undefined reference to `io_movestr'
ciol.c:(.text+0x556): undefined reference to `io_movestr'
ciol.c:(.text+0x595): undefined reference to `io_movestr'
ciol.c:(.text+0x601): undefined reference to `io_movestr'
The io_len and io_movestr are functions what I made. How to include this two function in my compile?
I already put these in ciol.h:
int io_len(char *str);
void io_movestr(char *str,int pos,int direct);
Thanks
I am guessing maybe you put the function prototypes:
ReplyDeleteint io_len(char *str);
void io_movestr(char *str,int pos,int direct);
under the BCC and VCC platform and not the LNX maybe?
Thanks for the reply.
ReplyDeleteI put the code in common place:
void io_init();
void io_end();
void io_flush();
int io_getch();
void io_move(int row, int col);
void io_putch(int ch);
void io_putstr(const char *str);
int io_rows();
int io_cols();
void io_clrscr();
int io_len(char *str);
void io_movestr(char *str,int pos,int direct);
void io_display(const char *str, int row, int col, int len);
int io_edit(char* str, int row, int col, int fieldlen, int maxdatalen, int *insertmode, int* offset, int* curpos, int IsTextEditor);
void io_displayflag(const char *format, int row, int col, int status);
int io_flag(const char *format, int row, int col, int* status, int radio);
void io_displayMenuItem(const char *format, const char *menuItem, int row, int col, int len, int status);
int io_menuItem(const char *format, const char *menuItem, int row, int col, int len, int* status);
It's mixed with other functions, so it shouldn't because of that problem.
Perhaps you put your 2 functions source code under BCC or VCC and not outside of it with the other functions?
ReplyDeleteThanks for helping me.
ReplyDeleteI just checked my code again.
in ciol.h, it is in one block.
But in ciol.c, There are in 2 blocks. VCC and LINUX.
I forgot to put it in the Linux section.
Now it is compiled and run successfully.
No problem. Happy to help.
ReplyDelete