Originally Posted by
Bennie98
thx for the info, but i checked and it was already on
so I think we were both talking about the same thing... and when you define those libraries... how does he know where to get them? they aren't in the PellesC-folder... or he gets them somewhere in windows... if so.. where?
I'm not grasping the total concept of programming yet... sometimes that bothers me a bit
If you look in tools->options->folders you will find paths to the includes and libraries. This is the default setup for PellesC and it's good enough for most cases. Of course as you progress and begin creating your own libraries you can create your own folders in your project space and add them to these lists so you can index your stuff just like it's part of the standard library.
Also if you have project level libraries --say a communications .lib that gets used in both client and server-- you can add the folder(s) to your project folders (project options in the project menu) and index them for that project only.
For the standard windows libraries...
C-99 allows a #pragma comment(lib: Library.nam) to be used to automatically inform the linker which libraries to use. PellesC has a macro #pragma lib() as well. I generally like the shorter form, even though it's not standard C.
When you use #include <windows.h> it will search the "Includes" folders for the header file. But you would normally have to manually add the associated libraries to the linker's list in your project options.
Some time ago Pelle (and a couple of his supporters) went into the windows headers and added the pragamas so that when you define WIN32_DEFAULT_LIBS and load a header you are also indexing the necessary libraries.
For example in winsock2.h you will find...
Code:
#if defined(WIN32_DEFAULT_LIBS)
#pragma comment(lib, "user32.lib")
#endif
Now please be aware this is neither standard C nor standard Windows... but it's just handy as all git when writing windows code. The libraries line in my linker panel, in project options, is typically blank... and it works perfectly.
Coming from a Pascal background, where units and unit names had meaning, I was a lot confused over the fact that headers didn't connect to anything, filenames were totally arbitrary, libraries and objects didn't correspond with headers of the same name and so on. When I discoverd this feature of PellesC I was all over it. It very nicely got me over that transitional hump. Now, being a little further into C and beyond that initial confusion, I still find it to be a very handy convenience. It's one of those "What were they thinking" kind of things...
I gather you're using version 6.50... This is in the "release candidate" phase right now. You probably should join the Forums ( Pelles C forum - Index ) and help in debugging for the final release version, which probably won't be too far away. There's a pretty good crew over there as well. (I've stayed with 6.0 because I'm mid-project right now but will update as soon as I finish)