Closed wicked closed 7 years ago
Apologies for this. Did you manage to compile it in the end?
No I couldn't compile any of the versions except version 2.0.
Try removing the L infront of the strings in MessageBox(...) (line 47)
MessageBox(NULL, "Failed to install hook!", "Error", MB_ICONERROR);
In my case it would not compile without them, but your compiler may be different.
Edit: Technically you could just comment out that function, since it is only called incase the hook fails to install.
@wicked Please do what @Z0ckerchris suggested, then report back.
@Z0ckerchris What do you use as a compiler? Thanks for helping out!
Using Dev-C++ 5.11, TDM-GCC 4.9.2 64-bit Release, removed L infront of the strings in MessageBox(...) (line 47)
MessageBox(NULL, "Failed to install hook!", "Error", MB_ICONERROR);
E:\Github\giacomolaw\windows\klog_main.cpp In function 'LRESULT HookCallback(int, WPARAM, LPARAM)':
31 44 E:\Github\giacomolaw\windows\klog_main.cpp [Warning] deprecated conversion from string constant to 'char*' [-Wwrite-strings]
E:\Github\giacomolaw\windows\klog_main.cpp At global scope:
114 11 E:\Github\giacomolaw\windows\klog_main.cpp [Error] '::main' must return 'int'
Using Visual Studio 2015, Visual C++ Empty Project, klog_main.cpp inside Source Files folder.
C4996 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS.
Using fopen_s
C2660 'fopen_s': function does not take 2 arguments
62 a value of type "errno_t" cannot be assigned to an entity of type "FILE *"
62 argument of type "char *" is incompatible with parameter of type "FILE **"
62 too few arguments in function call
@wicked
Can you see if the older Windows version worked?
Sorry for the issues
Also, have you set whether the window is visible or not?
// defines whether the window is visible or not
// should be solved with makefile, not in this file
#define visible // (visible / invisible)
Using unmodified visible.
#define visible // (visible / invisible)
Using the older Windows version compiles, but with the following error on Dev-C++ 5.11, TDM-GCC 4.9.2 64-bit Release.
E:\Github\giacomolaw\windows\klog_main.cpp In function 'int main()':
18 29 E:\Github\giacomolaw\windows\klog_main.cpp [Warning] deprecated conversion from string constant to 'char*' [-Wwrite-strings]
klog_main.exe works well, but it on win10 it takes up recurring 50% cpu. On win7 it takes up 100%-97% cpu.
But on Visual Studio 2015, using the older version having similar problem on fopen
and fopen_s
.
@wicked Ah, okay. Does the new version compile for you even though the errors and work?
Thanks, sorry for the issue and the questions.
The newest version doesn't compile. No problem @GiacomoLaw , just reporting issues so other users won't have any trouble compiling.
Okay, thanks. Does anyone else have compilation issues? I don't get them on VS Community edition.
Thanks for reporting!
@GiacomoLaw I'm also using VS Community Edition
@wicked The fopen
is just a warning, which VS ignores until you tell it to treat them as error.
So it should compile if thats the only problem.
@GiacomoLaw is it possible to compile windows.cpp on linux gcc or g++?
@wicked If they can compile C++, yes
Just compiled using the same version of Dev-C++, with two errors but compiles just fine. I may have messed up installation last time. Thanks @GiacomoLaw
In function 'LRESULT HookCallback(int, WPARAM, LPARAM)': [Warning] deprecated conversion from string constant to 'char*' [-Wwrite-strings]
No problem, glad to see it worked for you!
I have tried compiling the source on Dev-C++ and Visual Studio 2016, resulting in various errors. Using latest on master windows.
On Dev-C++ 5.11
On Visual Studio 2015 Community Edition
Very frustrating to compile and not simple anymore. The simplier choice would be version 2.0 but it takes up recurring 100% cpu usage.