zhu
September 25, 2019, 2:08pm
21
yeah, I think so
here’s the example code:
int main () {
FILE *fp;
int c;
fp = fopen("file.txt","r");
while(1) {
c = fgetc(fp);
if( feof(fp) ) {
break ;
}
printf("%c", c);
}
fclose(fp);
return(0);
}
zhu
September 25, 2019, 2:12pm
22
ABout running fail in codeblock, I think it’s a codeblocks running environment issue
Then is should return ‘0’. But it was Process returned -1073741819 (0xC0000005) execution time : 1.873 s
zhu
September 25, 2019, 2:16pm
24
But it works well in command line, that prove it’s not a fopen issue.
kisvegabor:
0xC0000005
That is an “access violation” in Windows AFAIK (i.e. segfault).
zhu
September 25, 2019, 2:18pm
26
Yeah, something is wrong, but I believe it’s not a fopen issue,
Remember that you have to check the working directory of the CodeBlocks project. By default I think it’s the Debug
folder.
Your code doesn’t bother to check whether fp
is valid (i.e. if the file existed) so that’s probably why it crashes in CodeBlocks.
zhu
September 25, 2019, 2:24pm
28
Yeah, both the exmaple and lvgl exe files are in debug folders, and there are where I put the txt/bin files
fp should be valid, or it should fail in command line way too
zhu
September 25, 2019, 2:28pm
29
I think of a reason, CodeBlocks crash because it’s calling the program from another folder.
In command way, I’m in the debug folder to run the program
Right, that’s what I meant. Just because the program is located in a folder doesn’t mean that that is the working directory.
zhu:
fp should be valid
It’s generally a better idea to have a check in place for that rather than assuming that it will always be valid.
zhu
September 25, 2019, 2:30pm
31
Tried to run command line in another folder, crashed as CodeBlock do, so the reason confirmed,
1 Like
zhu
September 25, 2019, 2:33pm
32
Sure, I didn’t do that because don’t know how, just copied the example.
The problem is, when I try lvgl in command line, I’m in it’s debug folder but it still don’t work
zhu
September 25, 2019, 2:48pm
33
Look the pcfs_open:
static lv_fs_res_t pcfs_open(lv_fs_drv_t * drv, void * file_p, const char * fn, lv_fs_mode_t mode)
There’s a parameter called drv, what’s it when pcfs_open is called?
Sorry, I realize it’s ignored, never mind.
zhu
October 8, 2019, 1:14am
34
You may think why don’t you try eclipse in linux?
Actually, I tried that in fitst order but failed, I tried it recently again, in a different way, failed again.
Would you please make Install Eclipse CDT better, with more details?
What was the problem with installing Eclipse?
zhu
October 8, 2019, 5:50am
36
There’s no installer at https://www.eclipse.org/cdt/downloads.php , I did it by “apt install eclipse”, then when I try to install cdt in “help–install new software…”, it would complain lacking all kinds of packages.
Another way I tried is download a package from https://www.eclipse.org/cdt/downloads.php , extract it and run eclipse in the folder, it says “Cannot run program “make”: Unknown reason”
zhu
October 8, 2019, 8:39am
37
I’d got eclipse work in linux, got same result as codeblocks in windows, here’s the warnings:
Warn: Image draw cannot open the image resource |(…/lvgl/src/lv_draw/lv_img_cache.c #118 )
Warn: Image draw error |(…/lvgl/src/lv_draw/lv_draw_img.c #61 )
Why not try the main download page (Eclipse Downloads | The Eclipse Foundation )?
On any Linux system that you want to use for C development, you need basic tools like gcc
and make
installed. Normally build-essential
or a similar metapackage like that will install them. Google a basic tutorial on setting up Eclipse CDT if you need more help on that. Unless you were having a different issue?
Good point… it looks like the Eclipse website changed. We should update the link.