NO

Author Topic: Clean Compile, but POLINK gives 38 unresolved externals  (Read 11343 times)

JimJoyce

  • Guest
Clean Compile, but POLINK gives 38 unresolved externals
« on: February 12, 2014, 07:16:31 PM »
I'm fairly new.  I learnt (and taught) C some 20 years ago,
I tried Pelles-C about a year ago, but got nowhere.
I'm trying again. I've converted  about 300 lines of JS script into C,
but after finally getting a clean compile, when I try to execute
POLINK gives me 38 unresolved externals.

I'm sure there's a simple explanation, but where to find if ?
Thanks, in advance,
JJ

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: Clean Compile, but POLINK gives 38 unresolved externals
« Reply #1 on: February 12, 2014, 07:37:27 PM »
Can you give us list of unresolved externals ?
Are you compiling files __cdecl or __stdcall ?
What libraries are linked with that app ?
May the source be with you

Offline jj2007

  • Member
  • *
  • Posts: 536
Re: Clean Compile, but POLINK gives 38 unresolved externals
« Reply #2 on: February 12, 2014, 11:10:23 PM »
Hi JJ,

Does a hello world like this one build & run properly?

#include <stdio.h>

int main(int argc, char* argv[]) {
  long long q=1234567890123456789;
  printf("This is a long long: %lld\n", q);
  _getch();
}


It's most probably an issue with the linker's commandline, so it would be good if you could post that one here...

Cheers, JJ

Offline Bitbeisser

  • Global Moderator
  • Member
  • *****
  • Posts: 772
Re: Clean Compile, but POLINK gives 38 unresolved externals
« Reply #3 on: February 13, 2014, 10:50:24 PM »
I'm fairly new.  I learnt (and taught) C some 20 years ago,
I tried Pelles-C about a year ago, but got nowhere.
I'm trying again. I've converted  about 300 lines of JS script into C,
but after finally getting a clean compile, when I try to execute
POLINK gives me 38 unresolved externals.

I'm sure there's a simple explanation, but where to find if ?
Thanks, in advance,
JJ
As Timo already mentioned, the list of those externals is likely leading to the explanation. Most likely, you just need to include some appropriate header files into your source code. But as nobody around here is in possession of a working crystal ball, providing that list of unresolved externals would be needed to help you out...

Ralf

JimJoyce

  • Guest
Re: Clean Compile, but POLINK gives 38 unresolved externals
« Reply #4 on: February 15, 2014, 11:42:26 AM »
I'm fairly new.  I learnt (and taught) C some 20 years ago,
I tried Pelles-C about a year ago, but got nowhere.
I'm trying again. I've converted  about 300 lines of JS script into C,
but after finally getting a clean compile, when I try to execute
POLINK gives me 38 unresolved externals.

I'm sure there's a simple explanation, but where to find if ?
Thanks, in advance,
JJ
As Timo already mentioned, the list of those externals is likely leading to the explanation. Most likely, you just need to include some appropriate header files into your source code. But as nobody around here is in possession of a working crystal ball, providing that list of unresolved externals would be needed to help you out...

Ralf
I simply clicked the 'compile' option.
I added no conditions.
This is the list of missing externals:
Building hex.exe.
POLINK: warning: Invalid machine type in object 'C:\JData\CProgs\output\hex.obj'.
POLINK: warning: Invalid machine type in object 'crt.lib(fopen.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(printf.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(exit.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(puts.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_stoul.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(fprintf.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(fputs.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_ftol.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_fslot.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_fopen.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(fwrite.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_files.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_stbuf.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_printf.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_exit.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(fputc.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_ctypetab.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_tolowertab.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(memchr.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(errno.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_fwrite.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(strrchr.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_fflush.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(malloc.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(__fopen.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(fclose.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(isatty.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_mbtowc.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(strchr.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_putfield.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_puttxt.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(write.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_getmem.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(free.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_crt0dat.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_bigheap.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(open.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_atexit.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(close.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(remove.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_ioinit.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_state.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(__mbtowc.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_putstr.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_litob.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_fptestl.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_ldtob.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(constraint_handler_s.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(lseek.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_osfinfo.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_cp2cp.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_maperr.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(memcpy.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(read.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(chsize.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(abort.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(unlink.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_wctomb.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_ullmod.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_ulldiv.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_lldiv.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_llmul.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_fptest.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_fpunscalel.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_fpscalel.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_ftoll.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_genld.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(ldiv.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_strerror.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_chkstk.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(features.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(calloc.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(setmode.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(raise.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(__wctomb.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_fpunscale.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_fpscale.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(localeconv.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(div.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(memset.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(signal.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_fpnorm.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_values.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_crt0.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(seh2.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(seh1.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_heapsz.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(clock.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_setargv.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_setenvp.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_initex.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_xcptfilter.obj)'.
POLINK: warning: Invalid machine type in object 'crt.lib(_dflheap.obj)'.
POLINK: error: Unresolved external symbol '__imp__ExitProcess@4'.
POLINK: error: Unresolved external symbol '__imp__GetConsoleMode@8'.
POLINK: error: Unresolved external symbol '__imp__GetConsoleOutputCP@0'.
POLINK: error: Unresolved external symbol '__imp__WriteFile@20'.
POLINK: error: Unresolved external symbol '__imp__GetLastError@0'.
POLINK: error: Unresolved external symbol '__imp__VirtualAlloc@16'.
POLINK: error: Unresolved external symbol '__imp__VirtualQuery@12'.
POLINK: error: Unresolved external symbol '__imp__HeapCreate@12'.
POLINK: error: Unresolved external symbol '__imp__HeapDestroy@4'.
POLINK: error: Unresolved external symbol '__imp__HeapAlloc@12'.
POLINK: error: Unresolved external symbol '__imp__HeapReAlloc@16'.
POLINK: error: Unresolved external symbol '__imp__HeapFree@12'.
POLINK: error: Unresolved external symbol '__imp__HeapSize@12'.
POLINK: error: Unresolved external symbol '__imp__HeapValidate@12'.
POLINK: error: Unresolved external symbol '__imp__CreateFileA@28'.
POLINK: error: Unresolved external symbol '__imp__GetFileType@4'.
POLINK: error: Unresolved external symbol '__imp__CloseHandle@4'.
POLINK: error: Unresolved external symbol '__imp__GetStartupInfoA@4'.
POLINK: error: Unresolved external symbol '__imp__GetStdHandle@4'.
POLINK: error: Unresolved external symbol '__imp__GetCurrentProcess@0'.
POLINK: error: Unresolved external symbol '__imp__DuplicateHandle@28'.
POLINK: error: Unresolved external symbol '__imp__SetHandleCount@4'.
POLINK: error: Unresolved external symbol '__imp__MultiByteToWideChar@24'.
POLINK: error: Unresolved external symbol '__imp__SetFilePointer@16'.
POLINK: error: Unresolved external symbol '__imp__SetStdHandle@8'.
POLINK: error: Unresolved external symbol '__imp__WideCharToMultiByte@32'.
POLINK: error: Unresolved external symbol '__imp__ReadFile@20'.
POLINK: error: Unresolved external symbol '__imp__GetConsoleCP@0'.
POLINK: error: Unresolved external symbol '__imp__SetEndOfFile@4'.
POLINK: error: Unresolved external symbol '__imp__DeleteFileA@4'.
POLINK: error: Unresolved external symbol '__imp__SetConsoleCtrlHandler@8'.
POLINK: error: Unresolved external symbol '_RtlUnwind@16'.
POLINK: error: Unresolved external symbol '__imp__GetSystemTimeAsFileTime@4'.
POLINK: error: Unresolved external symbol '__imp__GetCommandLineA@0'.
POLINK: error: Unresolved external symbol '__imp__GetModuleFileNameA@12'.
POLINK: error: Unresolved external symbol '__imp__GetEnvironmentStrings@0'.
POLINK: error: Unresolved external symbol '__imp__FreeEnvironmentStringsA@4'.
POLINK: error: Unresolved external symbol '__imp__UnhandledExceptionFilter@4'.
POLINK: fatal error: 38 unresolved external(s).
*** Error code: 1 ***
Done.

Thanks, all, for your help.
JJ

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: Clean Compile, but POLINK gives 38 unresolved externals
« Reply #5 on: February 15, 2014, 12:33:05 PM »
Is that hex.c compiled with other than option -Tx86-coff ?
May the source be with you

JimJoyce

  • Guest
Re: Clean Compile, but POLINK gives 38 unresolved externals
« Reply #6 on: February 15, 2014, 04:14:56 PM »
Is that hex.c compiled with other than option -Tx86-coff ?

No, I see only four buttons:
Build, Compile, Execute and Debug.
I used the Compile button.
I'm not aware of any other options.
JJ

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: Clean Compile, but POLINK gives 38 unresolved externals
« Reply #7 on: February 15, 2014, 05:28:48 PM »
You must create a project first if you are unfamiliar with switches needed to compile executables.
Try again:
File->New->project  this will open the project wizard where you can choose a templete project or an empty project of the kind you need (consolle, GUI, static or dynamic lib).
Choose a directory where hold the project files and go...
The wizard will set all the appropriate switches for you.

P.S. if in your project you go to project->project options and under the compiler tab select MS extensions many errors will go away ;)
« Last Edit: February 15, 2014, 05:30:50 PM by frankie »
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

JimJoyce

  • Guest
Re: Clean Compile, but POLINK gives 38 unresolved externals
« Reply #8 on: February 17, 2014, 12:17:25 PM »
Thanks, everyone.
I'm now compiling fairly cleanly, just getting one warning:
Function 'main' can't be __fastcall, changed to __cdecl.
Not sure what that means. But it executes OK.
I say 'OK', but I'm starting a new thread with new problem.

Offline Bitbeisser

  • Global Moderator
  • Member
  • *****
  • Posts: 772
Re: Clean Compile, but POLINK gives 38 unresolved externals
« Reply #9 on: February 17, 2014, 10:08:51 PM »
Thanks, everyone.
I'm now compiling fairly cleanly, just getting one warning:
Function 'main' can't be __fastcall, changed to __cdecl.
Not sure what that means. But it executes OK.
I say 'OK', but I'm starting a new thread with new problem.
__fastcall is only for 64bit programs, you defined this somewhere in your project options but then actually tell the compiler to create a Win32 program, for which __fastcall isn't a vaild calling convention and hence the compiler changed that for you while giving you a warning about it....  ;)

Ralf

rhiltbrunn

  • Guest
Re: Clean Compile, but POLINK gives 38 unresolved externals
« Reply #10 on: December 22, 2015, 07:51:30 AM »
Just wanted to add my two cents.

I got very similar error messages because I created a 64 Windows console project then decided I wanted to switch to 32 bit. I just went into the project options and changed everything I could find from 64 to 32. When I tried to compile or build I got the POLINK external errors.

By saving the source somewhere else and creating a new project from the beginning as 32 bit console and then adding in the source, I was able to compile and build with no problems.

Cheers!

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: Clean Compile, but POLINK gives 38 unresolved externals
« Reply #11 on: December 22, 2015, 09:50:22 AM »
So LIB path was wrong.
Project options -> Macros is good place to check those ;)
May the source be with you