News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

unresolved external symbol

Started by clamicun, December 15, 2017, 08:52:50 PM

Previous topic - Next topic

clamicun

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--

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.

Jokaste

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

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

If I remember well the sqlite dll was cdecl not stdcall.

jj2007

Quote from: clamicun on December 16, 2017, 10:58:07 AMA 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

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

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.

clamicun

Fearless, thanks ... Interesting, I check this out ...

clamicun

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.   ??