User forums > Using Code::Blocks

Linking to Libraries

<< < (2/4) > >>

racer319:
No luck with removing the dll. And I'm not really sure how to use Dependency Walker. I opened the dll with it but what do I do then?

Also, is linking to the library all I need to do? Or do I also need a header file. b/c I've been including the SDL_gfxPrimitives.h header in my project which has the line:


--- Code: ---SDL_GFXPRIMITIVES_SCOPE int pixelRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
--- End code ---

In it, which is the function I'm trying to use, but it's not really a whole function. In the .cpp file the whole function is there but there's no way to link to it. It should be part of the library though right?

I turned on full compiler logging. Here's the error:


--- Code: ---\SDL\lib\libSDL_gfx.dll.a
obj\Debug\main.o: In function `SDL_main':
C:/SDLtest/main.cpp:38: undefined reference to `pixelRGBA'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 4 seconds)
1 errors, 234 warnings
--- End code ---

stahta01:
Please post the linking command; Edit3: This will be in the "Build Log" NOT IN the "Build Messages".

Note: This is not a valid Code::Blocks topic; so, the thread may be locked with no warning.

Edit: Including a header fixes Compiler Errors/Warning.
Adding the correct library to the linker command fixes linker errors like you have.

Edit2: Errors with "undefined reference" are always linker errors in my past experience.

Tim S.

racer319:
Oh okay sorry. Where should I have posted this?

When I change SDL_gfx to SDL_gfx.dll in my linker the error changes to 'was not declared in this scope'. which should I use?

stahta01:

--- Quote from: racer319 on May 02, 2012, 01:52:16 am ---Oh okay sorry. Where should I have posted this?

--- End quote ---

Once you get the Full Compiler Logging working; you can/should post the question on a programing, library, or compiler support site.

Programming in C or C++ Support site: http://cboard.cprogramming.com/

No idea which compiler you are using.

If MinGW GCC, I know of no good support site for it. Note: cboard.cprogramming.com does answer some Compiler support questions.

Tim S.

stahta01:

--- Quote from: racer319 on May 02, 2012, 01:52:16 am ---When I change SDL_gfx to SDL_gfx.dll in my linker the error changes to 'was not declared in this scope'. which should I use?

--- End quote ---

Without the full build log; there is no way I can help you.

Tim S.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version