Define a class

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Define a class

935件の閲覧回数
thoret
Contributor II

I try to write a simply programm and I want to define a class linke:

class myclass{

...

};

Directly I get an syntax error.

After I bulid the project I get an error:

Multiple markers at this line
    - Syntax error
    - unknown type name 'myclass'
    - expected '=', ',', ';', 'asm' or '__attribute__' before
     '{' token

I try to write it in a .h file and a .c

I work with LPCxpresso 8.2.2_650

I try to implemented math.h but the error still exist.

I think he dosn't know "class" but why? It is C syntax, isn't it?

ラベル(2)
0 件の賞賛
返信
3 返答(返信)

789件の閲覧回数
thoret
Contributor II

Thank you Guys.

It works.

0 件の賞賛
返信

789件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Thore T,

    Fall Guy is correct, Class is the data type for C++, not for C, so if you want to use the class type, please create a C++ source file instead of C file.

 

Wish it helps you!

If you still have question, please contact me!

Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

789件の閲覧回数
thefallguy
Contributor IV

Class is C++ and not C. In lpcxpresso you need to creat a C++ project and .cpp file for your code.