Author Topic: Error while build project with wxwidgets  (Read 760 times)

Offline Cloud_Strife_Han

  • Single posting newcomer
  • *
  • Posts: 7
Error while build project with wxwidgets
« on: January 21, 2018, 07:25:01 pm »
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:

Code: [Select]
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:

Quote
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)'|

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!
« Last Edit: January 22, 2018, 02:00:31 am by Cloud_Strife_Han »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6368
    • My Best Post
Re: Error while build project with wxwidgets
« Reply #1 on: January 21, 2018, 08:55:15 pm »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2105
Re: Error while build project with wxwidgets
« Reply #2 on: January 22, 2018, 09:09:10 am »
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)
Quote
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)'|
This error says exactly what is going on. You just have to read and maybe google....
Quote
error: 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