User forums > Help

Undefined reference to play(SDL_Surface*)

(1/1)

wilbefast:
Hi everyone  :?

I know this is borderline "programming" stuff but since Codeblock has special ways it likes you to link and include I thought I'd post it here - after all, I'm following a tutorial more or less word for word so in theory it should compile just fine ("should" ha ha ha). So, yeah, I keep getting this error in the main:


--- Code: ---Undefined reference to play(SDL_Surface*)
--- End code ---

screenshot

"Play" is a function that takes an SDL_Surface and draws stuff on it, in this case the default screen, but that's not important. Before anyone starts, I have indeed included "play.h" where the function is defined as:


--- Code: ---#ifndef PLAY_H_INCLUDED
#define PLAY_H_INCLUDED

void play(SDL_Surface* screen);
// (...)

#endif
--- End code ---

"play.c" is some 300 lines of code so I won't paste it in here. I made sure the files were indeed well included, as if I don't include "play.h" I get a different and altogether more familiar error:


--- Code: ---'play' not defined in this scope
--- End code ---


I'm pretty sure there's some option I haven't checked somewhere, but generally functions work fine without encouragement. What am I doing wrong?


William

Ceniza:

--- Quote from: wilbefast on September 26, 2009, 06:08:35 pm ---Hi everyone  :?

I know this is borderline "programming" stuff but since Codeblock has special ways it likes you to link and include I thought I'd post it here - after all, I'm following a tutorial more or less word for word so in theory it should compile just fine ("should" ha ha ha). So, yeah, I keep getting this error in the main:

--- End quote ---

The question is no borderline "programming" at all, it IS a programming question. Code::Blocks has NO special ways to link and include since it is not a compiler neither a linker. All Code::Blocks does is send what you instructed to the toolchain that you selected (GCC, MSVC, Digital Mars, Intel, ...), and that's it. In other words, you are asking in the wrong place.

Jenna:

--- Quote from: jens on September 12, 2009, 10:38:54 pm ---You should probably read something about how a build-process works.

If you do not know the difference between including header-files and linking libraries, you are missing some absolutely basic knwowledge and are definitely in the wrong forum.



--- End quote ---

That's what I answered in another thread with nearly the same question.
Learn the (programming) basics, read the (C::B) manual and you will find the answer.

And if not ... either stop programming or ask in the correct forum.


Topic locked !!

Navigation

[0] Message Index

Go to full version