[Solved] Compile error: invalid use of incomplete type
Posted: Wed Mar 02, 2016 7:17 am
Hi
Have updated my test program to use the latest version (v7) - and now I'm getting the following errors on compile:
This is a snippet of the code
In my main header file I am declaring like this:
and then using them globally like this:
I include chipmunk.h as the first include in my main header file.
This is on Linux (Debian Stretch with latest GCC compiler) and Codeblocks.
Any ideas on how to fix this?
Thanks
Have updated my test program to use the latest version (v7) - and now I'm getting the following errors on compile:
Code: Select all
||=== Build: Debug in para (compiler: GNU GCC Compiler) ===|
/home/x/storage/home/x/Devel/1_Current/physicsTest/Original/src/system/sys_startup.cpp||In function ‘bool sys_startOnce()’:|
/home/x/storage/home/x/Devel/1_Current/physicsTest/Original/src/system/sys_startup.cpp|111|error: invalid use of incomplete type ‘cpSpace {aka struct cpSpace}’|
hdr/chipmunk/chipmunk.h|115|note: forward declaration of ‘cpSpace {aka struct cpSpace}’|
/home/x/storage/home/x/Devel/1_Current/physicsTest/Original/src/system/sys_startup.cpp|116|error: invalid use of incomplete type ‘cpSpace {aka struct cpSpace}’|
hdr/chipmunk/chipmunk.h|115|note: forward declaration of ‘cpSpace {aka struct cpSpace}’|
/home/x/storage/home/x/Devel/1_Current/physicsTest/Original/src/system/sys_startup.cpp|119|error: invalid use of incomplete type ‘cpSpace {aka struct cpSpace}’|
hdr/chipmunk/chipmunk.h|115|note: forward declaration of ‘cpSpace {aka struct cpSpace}’|
/home/x/storage/home/x/Devel/1_Current/physicsTest/Original/src/system/sys_startup.cpp|122|error: invalid use of incomplete type ‘cpSpace {aka struct cpSpace}’|
hdr/chipmunk/chipmunk.h|115|note: forward declaration of ‘cpSpace {aka struct cpSpace}’|
/home/x/storage/home/x/Devel/1_Current/physicsTest/Original/src/system/sys_startup.cpp|125|error: invalid use of incomplete type ‘cpSpace {aka struct cpSpace}’|
hdr/chipmunk/chipmunk.h|115|note: forward declaration of ‘cpSpace {aka struct cpSpace}’|
/home/x/storage/home/x/Devel/1_Current/physicsTest/Original/src/system/sys_startup.cpp|130|error: invalid use of incomplete type ‘cpSpace {aka struct cpSpace}’|
hdr/chipmunk/chipmunk.h|115|note: forward declaration of ‘cpSpace {aka struct cpSpace}’|
/home/x/storage/home/x/Devel/1_Current/physicsTest/Original/src/system/sys_startup.cpp|131|error: invalid use of incomplete type ‘cpSpace {aka struct cpSpace}’|
hdr/chipmunk/chipmunk.h|115|note: forward declaration of ‘cpSpace {aka struct cpSpace}’|
||=== Build failed: 7 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
Code: Select all
gravity = cpv(0, 2);
space = cpSpaceNew();
cpSpaceSetGravity(space, gravity);
//
// Compile stops here
ground = cpSegmentShapeNew(space->staticBody, cpv(50, 200), cpv(350, 200), 0);
Code: Select all
extern cpSpace *space;
extern cpShape *ground;
extern cpVect gravity;
Code: Select all
cpSpace *space;
cpVect gravity;
cpShape *ground;
This is on Linux (Debian Stretch with latest GCC compiler) and Codeblocks.
Any ideas on how to fix this?
Thanks