Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: michaeltwozero on June 30, 2007, 06:26:16 pm

Title: Linking to win32 libarys using C::B
Post by: michaeltwozero on June 30, 2007, 06:26:16 pm
Hi all,

I am trying to use a windows libary namely: PSAPI.DLL

How do I link to it to resovle the external dependencies, in MSVC++ I go to Project -> settings and add "psapi.lib" to the list Link tab.

An example error is:
.objs\main.o:main.cpp:(.text+0x1d0): undefined reference to `GetModuleBaseNameA@16

Many thanks,
Mike.
Title: Re: Linking to win32 libarys using C::B
Post by: raph on June 30, 2007, 06:53:35 pm
Go to Project->Build options and go to Linker settings, there you can add the required libraries.
Title: Re: Linking to win32 libarys using C::B <modified>
Post by: michaeltwozero on June 30, 2007, 07:22:19 pm
raph,

I have tried to do this, I have added PSAPI.Lib, but I still get the errors:

.objs\main.o:main.cpp:(.text+0x19f): undefined reference to `EnumProcessModules@16'
.objs\main.o:main.cpp:(.text+0x1d0): undefined reference to `GetModuleBaseNameA@16'
.objs\main.o:main.cpp:(.text+0x27f): undefined reference to `EnumProcesses@12'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 1 seconds)
0 errors, 0 warnings

Ahhh, Sorry just added "PSAPI" I had browsed to the file in MS SDK,

Thanks for your help, sorry for not reading the answers properly.

Mike.