Author Topic: compiling dll wrapper problems - wrong IDE or compiler settings/flags  (Read 4528 times)

Offline evesira

  • Single posting newcomer
  • *
  • Posts: 3
Hello,

I am new to programming, so please correct me if I say something dumb.


I am attempting to write a dll wrapper for a small physics library called Chipmunk Physics:
http://code.google.com/p/chipmunk-physics/
The library is written in C, and uses C99 implementation. My wrapper code is in C++, and what I have so far I am sure is all syntactically valid code. I can compile the library alone, but not together with my wrapper code.

Right now, I'm getting errors like this:
... Chipmunk2GM\CODE\src\cpArbiter.h|47|error: `cpHashValue' does not name a type|
... Chipmunk2GM\CODE\src\cpArbiter.h|51|error: ISO C++ forbids declaration of `hash' with no type|
All of the errors are in the library's header files.


The library is in C99, which has some specifications that are ONLY allowed in C99. My wrapper code, as I said, is in C++. How do I get Code::Blocks to compile the library as C99 C, and my wrapper code as C++?


I'd be happy to upload my project file and the source if anyone is willing to take a look at them!

Many thanks!


Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: compiling dll wrapper problems - wrong IDE or compiler settings/flags
« Reply #1 on: January 03, 2010, 12:11:31 pm »
What version do you use?
Because the older version recongized C files as C++;
To verify goto Management -> Projects -> a C file -> right click -> Properties -> Advanced -> Compiler variable => should be C not CPP.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline evesira

  • Single posting newcomer
  • *
  • Posts: 3
Re: compiling dll wrapper problems - wrong IDE or compiler settings/flags
« Reply #2 on: January 04, 2010, 05:05:05 am »
Hello,

I'm using 8.02. The compile variable for all my C files is "CC". I tried changing one of them to "C", but an error still came up for that file.

I can upload the project file and code for this, if anyone is willing to take a look. It is not big.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: compiling dll wrapper problems - wrong IDE or compiler settings/flags
« Reply #3 on: January 04, 2010, 07:27:42 am »
"CC" is the correct one for C files, my mistake sorry.
So if this is OK, then you have a programming error (missing includes probably or something is not defined as it should)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline evesira

  • Single posting newcomer
  • *
  • Posts: 3
Re: compiling dll wrapper problems - wrong IDE or compiler settings/flags
« Reply #4 on: January 05, 2010, 12:08:40 am »
Well like i said, the chipmunk library itself compiles fine alone. When I put my wrapper code in there, some chipmunk headers throw errors, not my wrapper code files. That's why i'm pretty sure it's just some kind of settings problem...