Author Topic: things that dont work with code::blocks  (Read 3504 times)

Offline rain-13

  • Single posting newcomer
  • *
  • Posts: 5
things that dont work with code::blocks
« on: April 25, 2009, 05:20:55 pm »
1) When I create kernel driver . New > Project > kernel driver  ==> I cant compile it, it says "ntddk.h not found" but when I look in incrudes folder I see that there is ntddk.h, now I have question: why Code::Blocks cant find include file that is  in includes folder?

2) why exit(0); dont work with Code::blocks?

Here is my code.Actually I copied it...



Code: [Select]
/* copy.c written by [email protected]
 *
 * Very simple method to copy a file.
 *
 * http://www.metalshell.com/
 *
 */

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

void pHelp(char *me) {
  fprintf(stdout, "Usage: %s <srcfile> <destfile>\n", me);
  exit(0);
}

int main(int argc, char *argv[]) {
  int inF, ouF;
  char line[512];
  int bytes;

  if(argc < 3)
    pHelp(argv[0]);

  if((inF = open(argv[1], O_RDONLY)) == -1) {
    perror("open");
    exit(-1);
  }

  if((ouF = open(argv[2], O_WRONLY | O_CREAT)) == -1) {
    perror("open");
    exit(-1);
  }

  while((bytes = read(inF, line, sizeof(line))) > 0)
    write(ouF, line, bytes);

  close(inF);
  close(ouF);
}

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7253
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: things that dont work with code::blocks
« Reply #1 on: April 25, 2009, 08:19:48 pm »
1.) Do you really have ntddk.h in MinGW's include-folder or in include\ddk? For me it's the second. You should change #include <ntddk.h> to #include <ddk/ntddk.h> (works for me.

2.) You most likely do not have a c, but a c++-project. Remove the cpp-file from project, change the file-ending to c and readd it.

Your second question has nothing to do with C::B, and normally your topic would be locked or silently removed.

But your first question is a mix of a lack of knowledge and a C::B-issue.
That's the cause, why I give you some hints.