User forums > Using Code::Blocks

Linking error

<< < (2/3) > >>

Decrius:
Nope, its called libimageloader.a and is located in sltest/lib/

The only thing I did was:
- Make a static library project and build the example file that comes with it. Move the .a file to Packs/SLtest/lib/, and add that to the global search directories.
- Make a header file with the prototypes of the functions.
- Make a console library, link to to 'imageloader', include the header file, try to compile and it says 'undefined reference'.

I've re-done this several times, keep getting the same error, what if you guys do these steps, do you get the same error too?

Thank you for your time and effort :)
Derius

MortenMacFly:

--- Quote from: Decrius on April 15, 2008, 09:06:21 am ---I've re-done this several times, keep getting the same error, what if you guys do these steps, do you get the same error too?

--- End quote ---
I have done it similar and it just works. I have attached a sample workspace for your convenience. Probably this will help you to get where you want. I does not have a header file... this content is directly inside the main application (I was too lazy to do the header file...)

[attachment deleted by admin]

Decrius:
Yes, your project works for me, thank you.

But how could it possibly work? When I build the App, it includes the .a file, but it's never created...I don't see it appear neither do I compile the library...how could that ever work? How could it know the functions if the library isn't compiled, and how can it find these lib files?

Thank you.

MortenMacFly:

--- Quote from: Decrius on April 15, 2008, 01:20:55 pm ---how could that ever work? How could it know the functions if the library isn't compiled, and how can it find these lib files?

--- End quote ---
Trust me: the library *is* compiled. :D
I used a project dependency here - so the app project depends on the lib project which get's compiled automatically once you compile the app. Have a look int he "MyLib folder - there is the *.a lib created... for sure. If you create a workspace you can setup such dependencies between projects... there are also other ways to achieve such behaviour.

Decrius:
Are you sure? I don't see any .a file appear in the directories...=/

As for depencies, none of them is set AFAIK. App Project -> Project -> Properties -> Project's Dependencies -> box of Lib is not ticked...

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version