Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » CreateProcessW doesn't compile with CLANG
CreateProcessW doesn't compile with CLANG [message #59834] Mon, 01 May 2023 15:09 Go to previous message
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
Hello,

my the app call the windows API

CreateProcessW()


#ifdef PLATFORM_WIN32
   #include <windows.h>
#endif

...

#ifdef PLATFORM_WIN32
    strcpy( a, commandline);
    wchar aa[1000];
    wcscpy(aa, commandline.ToWString());

    STARTUPINFOW si;  //STARTUPINFO si; //for char
    PROCESS_INFORMATION pi;
    ZeroMemory( &si, sizeof(si) );
    si.cb = sizeof(si);
    ZeroMemory( &pi, sizeof(pi) );

    CreateProcessW( NULL,   // No module name (use command line)
        aa,         // Command line for wchar
        NULL,           // Process handle not inheritable
        NULL,           // Thread handle not inheritable
        FALSE,          // Set handle inheritance to FALSE
        CREATE_NO_WINDOW, //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

    // Wait until child process exits.
    WaitForSingleObject( pi.hProcess, INFINITE );

    // Close process and thread handles. 
    CloseHandle( pi.hProcess );
    CloseHandle( pi.hThread );
#else 
...


Under MSVC19 it compiles and run without problem. Now I am using CLANG (no Microsoft SDK on my machine) and the compiler complains about wcscpy() and CreateProcessW():

C:\MyApps\Vega82\RoundSwiss.cpp (132): error: no matching function for call to 'wcscpy'
(): wcscpy(aa, commandline.ToWString());
C:/upp/bin/clang/include/intrin.h (274): note: candidate function not viable: no known conversion from 'Upp::wchar[1000]' (aka 'unsigned long[1000]') to '
wchar_t *__restrict' for 1st argument
(): __MACHINEIW64(wchar_t *__cdecl wcscpy(wchar_t * __restrict__ ,const wchar_t * __restrict__ ))
C:/upp/bin/clang/include/intrin.h (186): note: expanded from macro '__MACHINEIW64'
(): #define __MACHINEIW64 __MACHINE
C:/upp/bin/clang/include/intrin.h (189): note: expanded from macro '__MACHINE'
(): #define __MACHINE(X) X;
C:\MyApps\Vega82\RoundSwiss.cpp (140): error: no matching function for call to 'CreateProcessW'
C:\MyApps\Vega82\RoundSwiss.cpp (222): error: no matching function for call to 'wcscpy'

Which include should I use? I tried to

#include <processthreadsapi.h>

and many others but without success.

Thanks,
Luigi

[Updated on: Mon, 01 May 2023 15:10]

Report message to a moderator

 
Read Message
Read Message
Read Message
Previous Topic: DropList STDFONT size changing after Drawn on screen
Next Topic: StrInt returning value
Goto Forum:
  


Current Time: Sat May 04 08:26:51 CEST 2024

Total time taken to generate the page: 0.02363 seconds