NO

Author Topic: Error while trying to create c files  (Read 6372 times)

ravenwingz

  • Guest
Error while trying to create c files
« on: November 27, 2012, 01:10:43 PM »
I am trying to learn C programming however i am constantly running into problems. I am using the book 'The C Programming Language'.
however whenever i try to run an example such as:
Code: [Select]
#include <stdio.h>

main()
{
int c;

c = getchar();
while (c != EOF) {
putchar(c);
c = getchar ();
}
}

I always get this error: 'POLINK: fatal error: File not found: 'advapi32.lib'.'

CommonTater

  • Guest
Re: Error while trying to create c files
« Reply #1 on: November 27, 2012, 01:49:46 PM »
This sounds like your installation of Pelles C isn't quite right...

Check in your Pelles C folder (usually c:\program files\pellesc) for a folder named  lib there you will find a folder named Win (and perhaps Win64) ...

Is advapi32.lib there (both times) ?
If not, then you will need to reinstall Pelles C. ... be sure to include windows develpment when you do.

If it is there, go to your main menu and click through ... Tools -> Options -> Folders -> Libraries and check that the lib, lib\win and lib\win64 folders are listed correctly.  If not, add them...

Also check in Project->Project Options->Folders->Libraries ... is one of the lib\win folders listed there? 

Also... on an unrelated note... many older books show the main function as you have it.  Under C99 and C-11 it should be
int main (void) and the function should return 0;   to the operating system.  (That will be one less warning you need to look at :D )


migf1

  • Guest
Re: Error while trying to create c files
« Reply #2 on: November 28, 2012, 06:30:27 PM »
...
Also... on an unrelated note... many older books show the main function as you have it.  Under C99 and C-11 it should be
int main (void) and the function should return 0;   to the operating system.  (That will be one less warning you need to look at :D )

+1!

If my memory serves me well, it is so since ISO C90 (it could be since ANSI C89, but I'm not sure).

CommonTater

  • Guest
Re: Error while trying to create c files
« Reply #3 on: November 28, 2012, 09:44:10 PM »
...
Also... on an unrelated note... many older books show the main function as you have it.  Under C99 and C-11 it should be
int main (void) and the function should return 0;   to the operating system.  (That will be one less warning you need to look at :D )

+1!

If my memory serves me well, it is so since ISO C90 (it could be since ANSI C89, but I'm not sure).


Been a good long time, in any case.

Offline Bitbeisser

  • Global Moderator
  • Member
  • *****
  • Posts: 772
Re: Error while trying to create c files
« Reply #4 on: November 29, 2012, 03:44:20 AM »
If my memory serves me well, it is so since ISO C90 (it could be since ANSI C89, but I'm not sure).
Been a good long time, in any case.
Well, in any case, this has nothing to do with the OP's error he gets....  :-\

Ralf

CommonTater

  • Guest
Re: Error while trying to create c files
« Reply #5 on: November 29, 2012, 03:49:34 AM »
Well, in any case, this has nothing to do with the OP's error he gets....  :-\

True enough.  We're just killing time till he gets back to us...

Offline Bitbeisser

  • Global Moderator
  • Member
  • *****
  • Posts: 772
Re: Error while trying to create c files
« Reply #6 on: November 29, 2012, 04:10:30 AM »
I always get this error: 'POLINK: fatal error: File not found: 'advapi32.lib'.'
Please post your whole project (Tools->ZIP files) and post this as an attachment....

What you are (should be!) trying to create is a "console" program and as such, your example (with minor modifications to keep the standards happy <BFEG>) will compile just fine...

The error comes from the fact that this lib i snot within the linker path (and also not necessary), so you must somehow have messed with the project settings that the systems is trying to include this in the link process...

Ralf

AbBb

  • Guest
Re: Error while trying to create c files
« Reply #7 on: July 02, 2015, 09:23:09 PM »
This sounds like your installation of Pelles C isn't quite right...

Check in your Pelles C folder (usually c:\program files\pellesc) for a folder named  lib there you will find a folder named Win (and perhaps Win64) ...

Is advapi32.lib there (both times) ?
If not, then you will need to reinstall Pelles C. ... be sure to include windows develpment when you do.

Above worked for me. 

I had the same error message, so I "googled":  POLINK: fatal error: file not found: 'advap;32.lib'.

Google search led to this webpage - and the quote above worked...

I checked the suggested folders/directories and the file was not there - upon re-install it was (+ many others in BOTH folders).

I am posting this incase someone else gets the same error message and does a google search like I did

ALSO: I originally installed PellesC "Full" version - upon re-install (as suggested above) I installed "Normal".  I was then able to build my source code (no errors)

I hope this helps the next person(s)

Also *TY* CommonTater for the detailed instructions - very helpful & most appreciated

 :)