Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Is it possible to fix "too many arguments to function 'wcstok'" error in VS Code without changing the code?

+4 votes
asked Jan 21 by peace maker (160 points)

wcstok function in VS Code takes 2 arguments only, so when I try to compile something like this: wchar_t *pch = wcstok(sentences[i], L" ,", &pt);, I get "too many arguments to function 'wcstok'" error. 

Is it possible to change the definition of wcstok function from _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcstok(wchar_t*, const wchar_t*) to wchar_t *wcstok(wchar_t *restrict ws1, const wchar_t *restrict ws2, wchar_t **restrict ptr)?

1 Answer

0 votes
answered Jan 23 by Peter Minarik (86,240 points)
I think it depends on the libraries you're using. Online GDB works with the code you desire.

Are you working on Linux or Windows?

You should be able to set the desired C++ version. On Linux, you probably use a GNU compiler gcc or g++.

Look here at how to set the flags: https://stackoverflow.com/questions/66975491/how-to-use-c-20-in-g

Check this thread for Visual Code C++ setting: https://stackoverflow.com/questions/62100553/how-do-i-use-c20-in-vscode

Good luck!
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...