Can't use string functions

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Can't use string functions

1,879 次查看
Drake
Contributor II

I am including <stdio.h> and <string.h> but nothing I do will cause the compiler to recognize any string functions.

 

I checked my lib paths and includes.

 

Anybody have any ideas how I can get access to string functions?

标签 (1)
0 项奖励
回复
5 回复数

1,719 次查看
kef
Specialist I

What messages are you getting? Try creating new project using project wizard. No change? Then maybe your compiler need to be reinstalled.

0 项奖励
回复

1,719 次查看
Drake
Contributor II

It does not give an error message when it is compiled, but it crashes when it runs (illegal bp). The words string and strlen are not blue like other functions which are recognized.

 

I'll try creating a new  project wizard program, but this one was just created a week ago.

 

 

0 项奖励
回复

1,719 次查看
kef
Specialist I

string is not C keyword and thus is not colored by editor.

Only functions defined in your code are colored blue. strlen() is defined in library, so it stays black. Illegal breakpoint message in debugger is caused by improper usage of something. 

 

0 项奖励
回复

1,719 次查看
Drake
Contributor II

 

String should be a type rather than a keyword I would think.  In any case it is not colored or recognized and i can't use it with my compiler.

 

We loaded some legacy code in the compiler that used many string functions, They are all functional on a different machine, but this machine would not process them properly.  I think I will try to reinstall the compiler when I get a break from this schedule.

 

If anybody has any ideas about how I might change configuration to solve the problem I would appreciate your comments.

0 项奖励
回复

1,719 次查看
Lundin
Senior Contributor IV

Overall, it sounds like you are confused over the programming language. What language are you using?

 

There is no Codewarrior-supported language with a type called "String". C++ has the std::string type in the header <string>, not to be confused with <string.h> which is the C header for string handling functions.

 

If a C or C++ compiler can't link a library, it will tell you so when the linker is executed. You will not get runtime errors because of that, these are compiled languages, not interpreted. Runtime errors are most likely caused by bugs in the code or hardware issues.

0 项奖励
回复