Hi you guys,
I'm newbie in Code::Blocks. I'm compiling my project in Code::Blocks version 17.12 with wxWidgets 3.1.0 (my wxWidgets installed and compiled successful), but when I paste my code, which I compile with GNU GCC Compiler successful without using wxWidgets, then compile with wxWidgets, it occured some error:
This is my function that I get from msdn:
int enumReg() {
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
// Start the child process.
if( !CreateProcess( NULL, // No module name (use command line)
DRIVER32, // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Set handle inheritance to FALSE
0, // No creation flags
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
&si, // Pointer to STARTUPINFO structure
&pi ) // Pointer to PROCESS_INFORMATION structure
)
{
printf( "CreateProcess failed (%d).\n", GetLastError() );
return;
}
}and error:
QuoteE:\WorkSpace\Code\ForHelperGUI\ForHelperGUIMain.cpp|45|error: cannot convert 'const char*' to 'LPWSTR {aka wchar_t*}' for argument '2' to 'WINBOOL CreateProcessW(LPCWSTR, LPWSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, WINBOOL, DWORD, LPVOID, LPCWSTR, LPSTARTUPINFOW, LPPROCESS_INFORMATION)'|
Log:
Quote||=== Build: Debug in ForHelperGUI (compiler: GNU GCC Compiler) ===|
E:\WorkSpace\Code\ForHelperGUI\ForHelperGUIMain.cpp|16|warning: ignoring #pragma comment [-Wunknown-pragmas]|
E:\WorkSpace\Code\ForHelperGUI\ForHelperGUIMain.cpp||In function 'int enumReg()':|
E:\WorkSpace\Code\ForHelperGUI\ForHelperGUIMain.cpp|45|error: cannot convert 'const char*' to 'LPWSTR {aka wchar_t*}' for argument '2' to 'WINBOOL CreateProcessW(LPCWSTR, LPWSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, WINBOOL, DWORD, LPVOID, LPCWSTR, LPSTARTUPINFOW, LPPROCESS_INFORMATION)'|
E:\WorkSpace\Code\ForHelperGUI\ForHelperGUIMain.cpp|48|warning: format '%d' expects argument of type 'int', but argument 2 has type 'DWORD {aka long unsigned int}' [-Wformat=]|
E:\WorkSpace\Code\ForHelperGUI\ForHelperGUIMain.cpp||In function 'DWORD ListProcessModules()':|
E:\WorkSpace\Code\ForHelperGUI\ForHelperGUIMain.cpp|206|warning: deprecated conversion from string constant to 'TCHAR* {aka wchar_t*}' [-Wwrite-strings]|
E:\WorkSpace\Code\ForHelperGUI\ForHelperGUIMain.cpp|217|warning: deprecated conversion from string constant to 'TCHAR* {aka wchar_t*}' [-Wwrite-strings]|
E:\WorkSpace\Code\ForHelperGUI\ForHelperGUIMain.cpp||In member function 'void ForHelperGUIFrame::OnbtnDumpClick(wxCommandEvent&)':|
E:\WorkSpace\Code\ForHelperGUI\ForHelperGUIMain.cpp|251|warning: unused variable 'lpThreadID' [-Wunused-variable]|
E:\WorkSpace\Code\ForHelperGUI\ForHelperGUIMain.cpp|252|warning: unused variable 'hThreadArray' [-Wunused-variable]|
E:\WorkSpace\Code\ForHelperGUI\ForHelperGUIMain.cpp|260|warning: 'virtual void wxWindowBase::SetInitialBestSize(const wxSize&)' is deprecated: use SetInitialSize() instead. [-Wdeprecated-declarations]|
C:\wxWidgets-3.1.0\include\wx\window.h|1917|note: declared here|
E:\WorkSpace\Code\ForHelperGUI\ForHelperGUIMain.cpp|260|warning: 'virtual void wxWindowBase::SetInitialBestSize(const wxSize&)' is deprecated: use SetInitialSize() instead. [-Wdeprecated-declarations]|
C:\wxWidgets-3.1.0\include\wx\window.h|1917|note: declared here|
E:\WorkSpace\Code\ForHelperGUI\ForHelperGUIMain.cpp|260|warning: 'virtual void wxWindowBase::SetInitialBestSize(const wxSize&)' is deprecated: use SetInitialSize() instead. [-Wdeprecated-declarations]|
C:\wxWidgets-3.1.0\include\wx\window.h|1917|note: declared here|
E:\WorkSpace\Code\ForHelperGUI\ForHelperGUIMain.cpp|260|warning: 'virtual void wxWindowBase::SetInitialBestSize(const wxSize&)' is deprecated: use SetInitialSize() instead. [-Wdeprecated-declarations]|
C:\wxWidgets-3.1.0\include\wx\window.h|1917|note: declared here|
E:\WorkSpace\Code\ForHelperGUI\ForHelperGUIMain.cpp|260|warning: 'virtual void wxWindowBase::SetInitialBestSize(const wxSize&)' is deprecated: use SetInitialSize() instead. [-Wdeprecated-declarations]|
C:\wxWidgets-3.1.0\include\wx\window.h|1917|note: declared here|
E:\WorkSpace\Code\ForHelperGUI\ForHelperGUIMain.cpp|260|warning: 'virtual void wxWindowBase::SetInitialBestSize(const wxSize&)' is deprecated: use SetInitialSize() instead. [-Wdeprecated-declarations]|
C:\wxWidgets-3.1.0\include\wx\window.h|1917|note: declared here|
E:\WorkSpace\Code\ForHelperGUI\ForHelperGUIMain.cpp|260|warning: 'virtual void wxWindowBase::SetInitialBestSize(const wxSize&)' is deprecated: use SetInitialSize() instead. [-Wdeprecated-declarations]|
C:\wxWidgets-3.1.0\include\wx\window.h|1917|note: declared here|
E:\WorkSpace\Code\ForHelperGUI\ForHelperGUIMain.cpp|260|warning: 'virtual void wxWindowBase::SetInitialBestSize(const wxSize&)' is deprecated: use SetInitialSize() instead. [-Wdeprecated-declarations]|
C:\wxWidgets-3.1.0\include\wx\window.h|1917|note: declared here|
E:\WorkSpace\Code\ForHelperGUI\ForHelperGUIMain.cpp|260|warning: 'virtual void wxWindowBase::SetInitialBestSize(const wxSize&)' is deprecated: use SetInitialSize() instead. [-Wdeprecated-declarations]|
C:\wxWidgets-3.1.0\include\wx\window.h|1917|note: declared here|
E:\WorkSpace\Code\ForHelperGUI\ForHelperGUIMain.cpp||In function 'int enumReg()':|
E:\WorkSpace\Code\ForHelperGUI\ForHelperGUIMain.cpp|51|warning: control reaches end of non-void function [-Wreturn-type]|
||=== Build failed: 1 error(s), 16 warning(s) (0 minute(s), 2 second(s)) ===|
Please help me. Thank for reading!
Please report more information on your problem. At least post a build log!
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F (http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F)
And, please read the rules http://forums.next.codeblocks.org/index.php/topic,9996.0.html (http://forums.next.codeblocks.org/index.php/topic,9996.0.html)
Tim S.
1) The log you posted is not a full rebuild log as described in the link provided by sathta01. This is a list of errors and not quite useful....
2)
QuoteE:\WorkSpace\Code\ForHelperGUI\ForHelperGUIMain.cpp|45|error: cannot convert 'const char*' to 'LPWSTR {aka wchar_t*}' for argument '2' to 'WINBOOL CreateProcessW(LPCWSTR, LPWSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, WINBOOL, DWORD, LPVOID, LPCWSTR, LPSTARTUPINFOW, LPPROCESS_INFORMATION)'|
This error says exactly what is going on. You just have to read and maybe google....
Quoteerror: cannot convert 'const char*' to 'LPWSTR {aka wchar_t*}' for argument '2'
This error shows also that this is not a codeblocks issue, but a programming issue and so this forum is probably the wrong place to ask this kind of question