Author Topic: Kernel Mode Driver - compiler ignores #pragma once ??  (Read 4633 times)

Offline msim

  • Single posting newcomer
  • *
  • Posts: 8
Kernel Mode Driver - compiler ignores #pragma once ??
« on: January 06, 2017, 10:04:43 pm »

driver.c
http://pastebin.com/wAgePXwV

main.h ( note the #pragma once on top )
http://pastebin.com/CXhtq6fT

main.c
http://pastebin.com/cnTEr410

build log ( note "multiple definition of ' ... ' " )
http://pastebin.com/SVVma1GW

does the compiler ignore "#pragma once" ???

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7787
    • My Best Post
Re: Kernel Mode Driver - compiler ignores #pragma once ??
« Reply #1 on: January 06, 2017, 10:11:55 pm »
Please read the rules and CB FAQs.
http://forums.codeblocks.org/index.php/topic,9996.0.html

Post your C/C++ Questions and Compiler Questions on another site.
I suggest https://cboard.cprogramming.com/forum.php for C/C++ Questions.

Edit: The problem is bad code; not an compiler issue. Look up the term compilation unit and what it means in pragma once.

Tim S.
« Last Edit: January 06, 2017, 10:23:30 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline msim

  • Single posting newcomer
  • *
  • Posts: 8
Re: Kernel Mode Driver - compiler ignores #pragma once ??
« Reply #2 on: January 07, 2017, 12:14:11 am »
Please read the rules and CB FAQs.
http://forums.codeblocks.org/index.php/topic,9996.0.html

Post your C/C++ Questions and Compiler Questions on another site.
I suggest https://cboard.cprogramming.com/forum.php for C/C++ Questions.

Edit: The problem is bad code; not an compiler issue. Look up the term compilation unit and what it means in pragma once.

Tim S.

You could also tell me not to initialize global variables in a header file ..

Answer:
http://stackoverflow.com/questions/249701/why-arent-my-compile-guards-preventing-multiple-definition-inclusions

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7787
    • My Best Post
Re: Kernel Mode Driver - compiler ignores #pragma once ??
« Reply #3 on: January 07, 2017, 02:13:51 am »
Please read the rules and CB FAQs.
http://forums.codeblocks.org/index.php/topic,9996.0.html

Post your C/C++ Questions and Compiler Questions on another site.
I suggest https://cboard.cprogramming.com/forum.php for C/C++ Questions.

Edit: The problem is bad code; not an compiler issue. Look up the term compilation unit and what it means in pragma once.

Tim S.

You could also tell me not to initialize global variables in a header file ..

Answer:
http://stackoverflow.com/questions/249701/why-arent-my-compile-guards-preventing-multiple-definition-inclusions

Do you wish me to ask you to be banned?

If not, read and follow the rules!

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org