I am getting the error :
c:\program files\labpacks\visual c++\include\vclobjects.h(99) : error C3861: 'wcstombs_s': identifier not found
c:\program files\labpacks\visual c++\include\vclobjects.h(379) : error C3861: 'mbstowcs_s': identifier not found
Any ideas pls.
Try adding a "#include <stdlib.h> before #include'ing the vcl.h.
wcstombs_s and mbstowcs_s are both function that Microsoft declares in <stdlib.h>.
I'd advise not using those functions at all, if you care about portability of your code, but that's a moot point as you're using the VCL, which is also non-portable.
Thanks for the reply. The project does not use vcl.h. (it was made by someone else; i have to extend it, trying to compile it first) . Other than that, I am jotting down the list of #includes below:
Originally Posted by grumpy
Is there a dependency of the error on any of these headers. BTW can it be a compiler specific error; I am on Visual Studio 2008 SP1.
Sorry - I typed too fast, and meant before the vclobjects.h. The fact you are getting those error messages means one of those header files you listed (or a header that they #include .....) is #include'ing vclobjects.h. However, the missing symbols will be within <stdlib.h> if you are using Microsoft's compiler. Try placing #include <stdlib.h> before the first of those #include's you listed.
Those particular missing symbols are specific to Microsoft's compilers and the association libraries (although some other vendors may support them in the interests of compatibility).
Originally Posted by grumpy
The project has 5 source files and 5 corresponding header files. I tried by inserting '#include <stdlib.h>' in the first lines of all the 10 files ! Didnt work that way.
The function is supposedly declared in stdlib.h
However, it may have some conditional compilation guards, which prevent those declarations being visible in the project you're trying to build.
Now, if FOOBAR isn't set for your project, or some other header file before stdlib.h has #undef FOOBAR, then you won't see the declaration of wcstombs_s
const wchar_t *wcstr,
Nice to hear back from you. If I understood you point correctly, I can stdlib.h in the first line of the code to get over the issue. Pls. let me know if I am right. Actually I tried that but no joy.
To be honest, I think you should start with a new console project which has just stdlib.h and a main() calling wcstombs_s, just to prove to yourself that there isn't anything wrong with your environment.
Originally Posted by Salem
I tried as per you advice. I uninstalled Visual Studio 2008 and installed it back. Then opened the project as fresh (did not Ok when the prompt came up to open the existing project). when I started compiling it; this time it could not find the header file 'afxdtctl.h'. I then searched the entire computer for the path to this header file. It did not show up in the search !
BTW I had opened up another query just to get a second opinion from the people.
Salem's advice is for you to start with a new console project, i.e., an entirely new project, from scratch. This is just to test that you can call wcstombs_s with such a fresh project.
Hi Salem and laserlight,
I was able to compile the code. I was basically missing a header folder 'altmfc' at my end. Anyways, thanks for all the help.