User forums > Using Code::Blocks

build issue

(1/3) > >>

wiseguyin:
Hi all,
I am getting a compile error. Yes, I have read the general notice  before submitting issue. I am not going to ask a programming question.
The error I am getting is:
/home/xyz/Hello.h|7|error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Hello’|

The code at that point is:

--- Code: ---#ifndef HELLO_H
#define HELLO_H

class Hello { //Error happens here
    public:
        char greeting[6];
};

#endif

--- End code ---

So the default gcc compiler is not recognizing the keyword "Class".
So My question is: how do I change the compiler from gcc to g++ using Code::Blocks?

I tried hand-editing the cbp file but it complained that the compiler could not located.

Suggestions?

PS: If it helps: I am writing a Nautilus extension and will be mixing a lot of C and C++ code.

thanks,
w|z0

Dr.Optix:
When you create a Project/File choose C++ as the language you use. See screenshot.

[attachment deleted by admin]

stahta01:
Also, do not use .c as the file extension; it is preferred to use .cpp, under windows; but, not using .c should help.

Tim S

Jenna:
You can also try to configure g++ as c-compiler in the toolchain-executables tab.

But I don't know, if that has any side-effects.

wiseguyin:
@stahta01:

Since this 'sounds' the simplest, I will try this first. I have not tried the file renaming feature of code::Blocks yet.

@Dr.Optix:
This , I will do, if all else fails. I created the project as a shared object project/ not a console application, though.

@jens:
This is new; I will try this second.

Thanks guys.

Navigation

[0] Message Index

[#] Next page

Go to full version