Author Topic: unresolved external symbol  (Read 116 times)

clamicun

  • Member
  • ***
  • Posts: 250
unresolved external symbol
« on: December 15, 2017, 08:52:50 PM »
I have seen this error before but never thought much about it.

filename.obj : error link2001: unresolved external symbol _sqlite3_open
filename.exe : fatal error link1120 : 1 unresolved externals

I checked in the net but no very convincing explanation.
So what does it mean ?
0 warning 0 errors !!  ... no success

Some place in the net to enlighten me ?

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 4935
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: unresolved external symbol
« Reply #1 on: December 15, 2017, 09:30:00 PM »
You are either missing an include file or missing a library. Find out where _sqlite3_open comes from and get the required file then include it.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

Jokaste

  • Regular Member
  • *
  • Posts: 47
  • Never be pleased, always improve
    • Grincheux's Tools
Re: unresolved external symbol
« Reply #2 on: December 15, 2017, 10:16:23 PM »
http://www.sqlite.org/download.html


After use PoLib to create to import library from the ".def"
Vortex also has utilities that could help you.
Kenavo
---------------------------
Grincheux / Jokaste

clamicun

  • Member
  • ***
  • Posts: 250
Re: unresolved external symbol
« Reply #3 on: December 16, 2017, 10:58:07 AM »
Hutch, Jokaste,
thank you, but that was not my problem. The sqlite problem I ""resolved"" 1 minute later .
I was/am after some material (book, pdf, site)  which explains what really is happening there. (like I said ...which could "enlighten" me.
A message "0 warnings 0 errors" and no result is hard to digest, because certainly something is very wrong. 

aw27

  • Member
  • ****
  • Posts: 857
  • Let's Make ASM Great Again!
Re: unresolved external symbol
« Reply #4 on: December 16, 2017, 12:26:36 PM »
If I remember well the sqlite dll was cdecl not stdcall.

jj2007

  • Member
  • *****
  • Posts: 7758
  • Assembler is fun ;-)
    • MasmBasic
Re: unresolved external symbol
« Reply #5 on: December 16, 2017, 01:04:05 PM »
A message "0 warnings 0 errors" and no result is hard to digest, because certainly something is very wrong.

You build a project in two phases
- assemble
- link

The assembler sees a MyStuff proc in your code, and later on a call MyStuff. No problem.
But then there is an invoke GetTickCount but no GetTickCount proc ::)

So the assembler says "I don't know GetTickCount, error!"
Therefore we use an include file that contains GetTickCount PROTO to tell the assembler "don't worry, the linker will provide you with the address of that proc that you won't see in your code".

So with the PROTO, you get "0 warnings 0 errors" for the assembly phase, and afterwards the linker links everything together.
Except if it can't find GetTickCount, of course - then it complains "you cheated, there is no GetTickCount: unresolved external symbol".

clamicun

  • Member
  • ***
  • Posts: 250
Re: unresolved external symbol
« Reply #6 on: December 17, 2017, 05:08:44 AM »
jj thank you,
with this sqlite project I went the easier way. Using "Fresh IDE project - FreshLib reference - Flat Assembler" ... It comes with a sqlite3.inc file
which contains all protos you need.
There is an example in the net (https://stackoverflow.com/questions/11939956/how-can-i-use-sqlite3-with-masm32-on-windows) which looks ok. but produces exactely the "unresolved external error" .Do not know how this guy assembled it successfully.

fearless

  • Member
  • ***
  • Posts: 281
    • LetTheLightIn
Re: unresolved external symbol
« Reply #7 on: December 17, 2017, 06:47:49 AM »
I compiled a static version of SQLite for assembler and uploaded it to my github libraries repository: https://github.com/mrfearless/libraries/tree/master/SQLite

There is also a demo test RadASM project SQLiteTest by Mark Jones that i used to test the static libraries against and to verify it compiled and worked ok.

https://github.com/mrfearless/libraries/blob/master/releases/SQLite_x86.zip?raw=true
https://github.com/mrfearless/libraries/blob/master/releases/SQLiteTest.zip?raw=true

There is also an x64 version, but havent got round to testing that or verifying that the static x64 library is working.
fearless

CM690II Case, HX1000 PSU, Asus Z97, Intel i7-4790K, Seidon 120v Cooler, 16GB DDR3, MSI GTX 980TI, Samsung 256GB + 1TB SSD, WD Black 2TB x2 + 4TB HDD, Asus 27" LCD

www.LetTheLight.in  My Github

clamicun

  • Member
  • ***
  • Posts: 250
Re: unresolved external symbol
« Reply #8 on: December 17, 2017, 12:46:17 PM »
Fearless, thanks ... Interesting, I check this out ...

clamicun

  • Member
  • ***
  • Posts: 250
Re: unresolved external symbol
« Reply #9 on: Today at 11:58:21 AM »
Fearless,
your "SQLiteTest.asm from Github does it.
But not easyly.

First time it gave me:

0 warnings 0 errors and this...
warning LNK4044: unreecognized option "alternatename:__isa_available=__usa_available_default"; ignored
LINK fatal error LNK:1104: can not open file "uuid.lib"

I found an uuid.lib on my computer somewhere and put it into the SQLiteTest folder.
It worked.   ??