We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I'm using keil mdk V5, I included "string.h" but I still cannot use string, I get "error: use of undeclared identified 'string' message , anyone knows whats wrong with it?
Could you perhaps show some code?
Are you compiling as C++ code?
I'm using default arm 5 c/c++ compiler, as for the code it doesn't matter as even in new blank project I get same error.
Broman3100 said:c/c++
You understand that C and C++ are different languages?
You have to select one or the other:
http://www.keil.com/support/man/docs/armcc/armcc_chr1359124192674.htm
C++ has a 'string' type; C does not.
Hence Westonsupermare Pier's question:
Westonsupermare Pier said:Are you compiling as C++ code?
If you want to use 'string', you must compile as C++ - it will not work as C !
That is most likely my issue since I never checked it out... but I cant seem to find where I can select compiler, could you tell me how I can do it?
Broman3100 said:I cant seem to find where I can select compiler
It's a single compiler - but it can be configured to treat your source as either C or C++
By default:
Or you can use one of the options described in the link I gave to set it explicitly:
I changed it to c++ but I keep getting the exact same error, any idea what else could cause the issue?
"string.h" is a C include file. It gives you the standard C "string" (array of NULL terminated chars) functions. It has no type or class called string.
<string> will give you the C++ string stuff.