Sqlite3 h no such file or directory windows

I'm trying to build a C application through cross compiling for a Zynq board (ARM architecture). When I type make without mentioning the ARM arch, it works fine on my laptop. But as soon as I modif...

You don’t provide enough information to say for sure: in particular, you don’t say where the sqlite3.h file actually is on your filesystem. However, based on what you do show I suspect you need to change the INCLUDES variable, to this:

INCLUDES = lib/sqlite

(or else change the #include in your code to be #include "sqlite/sqlite3.h"). This is assuming that the header file is in the same directory as the sqlite3.c source file.

Note that this is a bad/confusing implementation. You should be putting the -I flag in the INCLUDES variable:

INCLUDES = -Ilib/sqlite
    ...
$(PROGRAM): $(SOURCE)
        $(CC) $(SOURCE) $(INCLUDES) -o$(PROGRAM) $(LDFLAGS)

INCLUDES is plural which may lead someone to believe they could add multiple directories in that variable, but if you leave it the way you have it, this will cause strange compiler errors:

INCLUDES = lib/sqlite another/dir
    ...
$(PROGRAM): $(SOURCE)
        $(CC) $(SOURCE) -I$(INCLUDES) -o$(PROGRAM) $(LDFLAGS)

will add the flags -Ilib/sqlite another/dir… note how the second directory doesn’t have a -I option.

Of course, by convention you should be using CPPFLAGS (for C preprocessor flags), not INCLUDES, but… :)

  • Remove From My Forums
  • Question

  • Hi

    I’ve a very basic issue but its baffling me.I’m using VS 2010 in a Windows environment and using c++/cli. The program I’m writing compiles fine with the line:

    #include «sqlite3/sqlite3.h»

    where I’ve got sqlite3 stored on C: drive in a sqlite3 folder. It doesn’t have to be there just is at the moment.

    My problem is I want to add some header files from a sqlite wrapper from another source [ I’ll call them a.h, b.h etc ].

    Each header file has #include <sqlite3.h> and generates an error on compilation: «No such file or directory».

    How can I get round this please?

Answers

  • Well, there’s some subtle difference between #include <> vs #include «»

    but if you specify the include directory it should work. Check again what you’ve entered where.

    —pa

    • Marked as answer by

      Friday, November 2, 2012 12:54 AM

By the where can I find a simle tutorial about the work with the
«sqlite» from the Python?

Once you get the connection, you can pretty much just do whatever if
you know SQL. Here’s some working code from one of my little projects:

#!/usr/bin/env python

from pysqlite2 import dbapi2 as sqlite

import time
#import sys

sqliteDatabase = «status.db»

connection = sqlite.connect(sqliteDatabase)
cursor = connection.cursor()
cursor.execute(‘CREATE TABLE IF NOT EXISTS auctions (auction_id
INTEGER PRIMARY KEY, numBids INTEGER, currentPrice INTEGER, timestamp
TEXT(50), itemTitle TEXT(100))’)
connection.close()

local = time.localtime()
timeStamp = «%s-%02d-%02d_%02d:%02d» % (local[0], local[1], local[2],
local[3], local[4])

def recordExists(auctionID):

connection = sqlite.connect(sqliteDatabase)
cursor = connection.cursor()
cursor.execute(‘SELECT COUNT(auction_id) FROM auctions WHERE
auction_ID = ‘ + auctionID.__str__())
for row in cursor:
return row[0]

cursor.close()

connection.close()

def retrieveAuctionInfo(auctionID):
connection = sqlite.connect(sqliteDatabase)
cursor = connection.cursor()
cursor.execute(‘SELECT currentPrice, numBids FROM auctions
WHERE auction_ID = ‘ + auctionID.__str__())
for row in cursor:
return [row[0],row[1]]

cursor.close()

def insertAuction(auctionID, currentPrice, currentBids, itemTitle):

itemTitle = itemTitle.replace(‘»‘, ‘»»‘)

connection = sqlite.connect(sqliteDatabase)
cursor = connection.cursor()
insertQuery = ‘INSERT INTO auctions (auction_id, currentPrice,
numBids, timestamp, itemTitle) VALUES (%s, %s, %s, «%s», «%s»)’ %
(auctionID, currentPrice, currentBids, timeStamp, itemTitle)
cursor.execute(insertQuery)
connection.commit()

cursor.close()

connection.close()

def updateAuction(auctionID, currentPrice, currentBids):

connection = sqlite.connect(sqliteDatabase)
cursor = connection.cursor()
updateQuery = ‘UPDATE auctions SET currentPrice = %s, numBids =
%s, timestamp = «%s» WHERE auction_id = %s;’ % (currentPrice,
currentBids, timeStamp,auctionID)
cursor.execute(updateQuery)
connection.commit()

cursor.close()
connection.close()

def getTotalAmount():

connection = sqlite.connect(sqliteDatabase)
cursor = connection.cursor()
selectQuery = «SELECT SUM(currentPrice) FROM auctions WHERE numBids > 0;»
cursor.execute(selectQuery)
for row in cursor:
return float(row[0])

cursor.close()

connection.close()

def displayAuctions(sortBy=»timestamp DESC»):

connection = sqlite.connect(sqliteDatabase)
cursor = connection.cursor()
selectQuery = «SELECT auction_id, numBids, currentPrice,
timestamp, itemTitle FROM auctions WHERE numBids > 0 ORDER BY » +
sortBy + «;»
cursor.execute(selectQuery)
for row in cursor:
auctionID, numBids, currentPrice, timestamp, itemTitle = row

print «%25s $%6.2f (%2s bids) Last update: %16s» %
(itemTitle[:25], currentPrice, numBids, timestamp)

cursor.close()

print «»

connection.close()

if __name__ == «__main__»:
displayAuctions(«currentPrice DESC»)
displayAuctions()
#displayAuctions(«numBids DESC»)
print «$%3.2f» % getTotalAmount()

You are not logged in. Please login or register.

Active topics Unanswered topics

QElectroTech → Code → Building QET from source — sqlite3 development package not found

Pages 1

You must login or register to post a reply

1 2021-06-29 13:07:46

  • lucas
  • Nouveau membre
  • Offline

Topic: Building QET from source — sqlite3 development package not found

I am trying to build QElectroTech from source on Windows. I think I am almost there. However, I am stuck when running qmake, I get the following error

12:58:22: Starting: "C:Qt5.15.0mingw81_64binqmake.exe" C:UsersLucasDevelopment_qetqelectrotech-source-mirrorqelectrotech.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
Project ERROR: sqlite3 development package not found
12:58:22: The process "C:Qt5.15.0mingw81_64binqmake.exe" exited with code 3.
Error while building/deploying project qelectrotech (kit: Desktop Qt 5.15.0 MinGW 64-bit)
When executing step "qmake"

Any idea how to fix this? This might of course also be a problem with my Qt installation.

2 Reply by scorpio810 2021-06-29 17:18:16

  • scorpio810
  • scorpio810
  • QElectroTech Team Manager, Developer, Packager
  • Offline

Re: Building QET from source — sqlite3 development package not found

Project ERROR: sqlite3 development package not found

Install  sqlite3 development package, or in qelectrotech.pro

#comment the line below to disable the project database export
DEFINES += QET_EXPORT_PROJECT_DB

And comment :

unix|win32: PKGCONFIG += sqlite3

3 Reply by Joshua 2021-06-29 18:06:51

  • Joshua
  • Joshua
  • QElectroTech Team Developer
  • Offline

Re: Building QET from source — sqlite3 development package not found

We cross compil QElectroTech for windows on linux system, so we never build qelectrotech on windows.
The few time who I build Qet on windows, I comment the things related to sqlite3 (see the post of scorpio).

May be you can test this : https://gist.github.com/zeljic/d8b54278 … 169ee28c55

If they work for you, you can feedback to us how to ?

4 Reply by lucas 2021-06-30 12:27:57 (edited by lucas 2021-06-30 12:30:36)

  • lucas
  • Nouveau membre
  • Offline

Re: Building QET from source — sqlite3 development package not found

Thank you for your help @Joshua and @scorpio810

I am able to compile qet now by commenting out the lines in the qmake file and it seems to work. I had to add the «sqlite3.h» header file to the Qt include directory. Otherwise I would get the following error

projectdatabase.cpp:33: error: sqlite3.h: No such file or directory
..qelectrotech-source-mirrorsourcesdataBaseprojectdatabase.cpp:33:10: fatal error: sqlite3.h: No such file or directory
 #include <sqlite3.h>

But fortunately there weren’t any further compile or link errors after that.

I wasn’t so far able to compile it with sqlite3. It seems like qmake tries to look for the «libsqlite3-dev» package, which I cannot install for windows. But I am not that familiar with the Qt build process to figure out where to adapt this. @Joshua I was able to build the sqlite3.lib file with the instructions you linked. It’s just not so clear how to make the build process digest it. I will investigate this a little bit further and will let you know if i find a way to do it.

5 Reply by scorpio810 2021-06-30 12:45:40

  • scorpio810
  • scorpio810
  • QElectroTech Team Manager, Developer, Packager
  • Offline

Re: Building QET from source — sqlite3 development package not found

Sqilte3 dependency is only for nomenclature database export to file function.

6 Reply by scorpio810 2021-06-30 12:58:38

  • scorpio810
  • scorpio810
  • QElectroTech Team Manager, Developer, Packager
  • Offline

Re: Building QET from source — sqlite3 development package not found

7 Reply by lucas 2021-07-01 11:10:44 (edited by lucas 2021-07-01 11:17:48)

  • lucas
  • Nouveau membre
  • Offline

Re: Building QET from source — sqlite3 development package not found

I get everything to compile now. It’s not in particular nice how I do it. I add the path of the sqlite3.h file and the sqlite3.dll manually in the qmake file and remove the dependency on the sqlite3 development package for windows. I don’t have to make any other changes to source files. It also works to statically link the sqlite3 library by just including the full flat sqlite3.c file into the project, but I liked this even less. If I find a better way, I’ll let you know.

unix: PKGCONFIG += sqlite3 
win32: CONFIG += sql

win32:LIBS += "C:/<path>/sqlite3.dll"
win32:INCLUDEPATH += "C:/<path>"    #path to sqlite3.h header file

8 Reply by scorpio810 2021-07-01 13:30:26

  • scorpio810
  • scorpio810
  • QElectroTech Team Manager, Developer, Packager
  • Offline

Re: Building QET from source — sqlite3 development package not found

9 Reply by Joshua 2021-07-01 22:22:24

  • Joshua
  • Joshua
  • QElectroTech Team Developer
  • Offline

Re: Building QET from source — sqlite3 development package not found

May be we can just add the header and the dll of sqlite3 in a sub dir of QElectroTech and then write a relative path into qelectrotech.pro ?
Should the dll be created for each version of windows or the same dll work for every version of windows?

Posts: 9

Pages 1

You must login or register to post a reply

QElectroTech → Code → Building QET from source — sqlite3 development package not found

Generated in 1.076 seconds (10% PHP — 90% DB) with 9 queries

I have just started with C programming and am originally a python programmer so please try and not use very advanced words I wont understand much. So when I try using gcc as my compiler as I get an error saying sqlite3.h no such file or directory found. Thats turning out to be a problem for me.

Any help will be appreciated.
Thank You.
The Terminal!

asked Apr 22, 2021 at 6:04

The Terminal's user avatar

You will have to install the package libsqlite3-dev (How I found it out).

Open a terminal and enter the command

sudo apt install libsqlite3-dev

answered Apr 22, 2021 at 6:09

Archisman Panigrahi's user avatar

4

Понравилась статья? Поделить с друзьями:
  • Sqlite3 dll скачать бесплатно windows 10
  • Sqlite3 dll не предназначена для выполнения в windows
  • Sqlite скачать для windows 10 на русском
  • Sqlite скачать для windows 10 как установить
  • Sqlite studio скачать 32 bit для windows