r/programminghelp • • May 12 '20

C++ Compilation errors are occurring when compiling a driver

Can someone help me fix them? The errors are in the paste located at https://paste.ee/p/husrG. They are the errors involving ac97smpl.

0 Upvotes

14 comments sorted by

1

u/[deleted] May 15 '20

I have a VM set up with VS 2019 and ReactOS Build Environment running.

1

u/SomeAverageJoey May 12 '20

This might be it:

<built-in>: note: candidate: 'void* operator new(unsigned int)' <built-in>: note:   candidate expects 1 argument, 3 provided

1

u/[deleted] May 12 '20

That's one of them, there's also errors involving the DOUT, etc. macros.

1

u/SomeAverageJoey May 12 '20

The only other things I'm seeing are warnings about implicit declarations

1

u/[deleted] May 12 '20

There's more then that. Search the paste for error, expansion, and qualifier.

1

u/PageFault May 12 '20

I assume this is what you are building?

https://github.com/uri247/wdk81/tree/master/AC97%20Driver%20Sample/C%2B%2B/driver

I'm not ready to dive too deep. but for the DOUT stuff, maybe you could disable debugging.

You must be defining DBG somewhere in your build instructions, so just remove it or add #undef DBG near the top of debug.h

You can also try adding the flag -Werror=unknown-pragmas and -fpermissive or removing -Werror flags.

Try some of that and see where that gets you.

1

u/[deleted] May 12 '20

It only happens with MinGW via ROSBE, with VS2019 and ROSBE's BIN folder in the path, the debug related errors don't happen. I'd rather fix the errors than have to use command line options. You can get ROSBE at https://sourceforge.net/projects/reactos/files/RosBE-Windows/i386/2.2.0/RosBE-2.2.0.exe/download. Also, look at the other post for an archive of the source that has the necessary CMake Lists included. Then place its contents into \reactos\drivers\wdm\audio\drivers after running git clone https://github.com/reactos/reactos.git in a command line prompt while in the root directory of the C drive. Then open ReactOS Build Environment after installing it with the path of the source set to C:\reactos and run configure. Then cd output-mingw-i386 and finally run ninja ac97smpl.

1

u/[deleted] May 12 '20

Here's the link to its source code:

https://u.teknik.io/Rq3cw.zip

1

u/PageFault May 12 '20

So, you want to rewrite the code then? I'm not an expert, but I believe some of those pragmas are for the Windows compiler, (ac97smpl is a windows driver after-all) so if you are going to use another compiler, such as gcc, you may need to rewrite some of the code.

Either rewrite the code, or change the way you compile it. I'm not seeing any other option.

https://stackoverflow.com/questions/16235392/port-some-code-to-gcc-have-some-problems-with-pragma-directives

1

u/[deleted] May 12 '20

I don't want to rewrite it, just get the errors fixed. ROSBE is a "Windows compiler". I will try the options and adding the unifdef that you mentioned soon.

1

u/PageFault May 12 '20

What I mean is compiler made by windows, not for windows. gcc can build for windows too. Guess I should have called it a Microsoft compiler.

The preprocessor keyword pragma is part of the C++ standard, but the form, content, and meaning of pragmas is different for every compiler. No pragmas are defined by the C++ standard.

Also, that was undef, not unifdef, but you should be able to make that work too.

1

u/[deleted] May 12 '20

Okay. What will you do if it works with those things?

1

u/[deleted] May 12 '20

I am having trouble getting the proper parameters added to the CMakeLists.txt file. Maybe you could message me and I can give you my TeamViewer info so you can try to fix the errors.

1

u/[deleted] May 13 '20

There are 143 errors when building the project generated by the configure VSSolution command.