|
>> #pragma comment(lib, "sqlite.lib")
Use a MAKE file to direct the linker to search for functions in that particular
library(.lib) is a more portable way I think, since this directive would be unknown with some compilers other than Microsoft's.
|
|
|
|
|
6Qing88 wrote: Use a MAKE file to direct the linker to search for functions in that particular library(.lib) is a more portable way I think
Hell, yeah - but given the OP was commenting like "what's a linker", I thought this was the simplest way to get their code to build
I wish all compilers had that directive - makes building so much easier. I love the way Boost uses it, with auto-selection to decide which of 4 or 6 library variants to link with
|
|
|
|
|
This page[^] gives an example of how to connect to a SQLite database with the C/C++ bindings.
This page[^] gives you more information about what's available in the C/C++ bindings for SQLite.
This page[^] has a downloadable e-book that shows you how to use SQLite with Visual C++ (see chapter 3 for instructions about how to build your program) [edit]This is a pay-for e-book - didn't notice that before- DOH![/edit].
And then there's this CodeProject article[^] (you know, CodeProject, the site you're asking this question on) that has a C++ wrapper for SQLite.
Google is your friend...
[edit]The CodeProject article tells you all you need to get started with SQLite. I see you've commented on the article already - if you can't make progress even after reading that article, I think you need to learn some basics about how to build C++ programs with third-party libraries...[/edit]
|
|
|
|
|
hi, i have tried to code the connection. It shows 1 error message. Don't really understand what is it..below is the code and error message.
Code:
// sparta1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "sqlite3.h"
#include <iostream>
#include "SQLAPI.h"
//#include <stdio.h>
//#include "Sl3API.h"
#pragma comment (lib,"sqlite3.lib")
int main(int argc, _TCHAR* argv[])
{
SAConnection con; //create connection object
SACommand cmd; // create command object
//&SAConnection::setClient;
con.setClient(SA_SQLite_Client);
void Connect(const SAString &sDBString, const SAString &sUserID, const SAString &sPasswords,SAClient_t eSAClient);
con.Connect("WORM.sqlite", "", "","SA_SQLite_Client");
cmd.setConnection(&con);
}
error message:
1>------ Build started: Project: sparta1, Configuration: Debug Win32 ------
1>Compiling...
1>sparta1.cpp
1>c:\users\vani\documents\visual studio 2005\projects\sparta1\sparta1\sparta1.cpp(29) : error C2664: 'SAConnection::Connect' : cannot convert parameter 4 from 'const char [17]' to 'SAClient_t'
1> There is no context in which this conversion is possible
1>Build log was saved at "file://c:\Users\Vani\Documents\Visual Studio 2005\Projects\sparta1\sparta1\Debug\BuildLog.htm"
1>sparta1 - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
|
|
|
|
|
In
con.Connect("WORM.sqlite", "", "","SA_SQLite_Client");
should SA_SQLite_Client have quotes around it? That looks more like a variable or function name. As it's also the parameter that the compiler's complaining about, that may be the issue?
If it should be quoted - what are the constructors for SAClient_t ?
|
|
|
|
|
owh...i just noticed..the last parameter don't require quotes. But the error message is way to many after removing the quotes now.
// sparta1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "sqlite3.h"
#include <iostream>
#include "SQLAPI.h"
//#include <stdio.h>
//#include "Sl3API.h"
#pragma comment (lib,"sqlite3.lib")
int main(int argc, _TCHAR* argv[])
{
SAConnection con; //create connection object
SACommand cmd; // create command object
//&SAConnection::setClient;
con.setClient(SA_SQLite_Client);
//void Connect(const SAString &sDBString, const SAString &sUserID, const SAString &sPasswords,SAClient_t eSAClient);
con.Connect("WORM.sqlite", "1234", "1234",SA_SQLite_Client);
cmd.setConnection(&con);
}
error message:
1>------ Build started: Project: sparta1, Configuration: Debug Win32 ------
1>Compiling...
1>sparta1.cpp
1>Linking...
1> Creating library C:\Users\Vani\Documents\Visual Studio 2005\Projects\sparta1\Debug\sparta1.lib and object C:\Users\Vani\Documents\Visual Studio 2005\Projects\sparta1\Debug\sparta1.exp
1>sparta1.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall SAConnection::~SAConnection(void)" (??1SAConnection@@UAE@XZ) referenced in function _main
1>sparta1.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall SACommand::~SACommand(void)" (??1SACommand@@UAE@XZ) referenced in function _main
1>sparta1.obj : error LNK2019: unresolved external symbol "public: void __thiscall SACommand::setConnection(class SAConnection *)" (?setConnection@SACommand@@QAEXPAVSAConnection@@@Z) referenced in function _main
1>sparta1.obj : error LNK2019: unresolved external symbol "public: __thiscall SAString::~SAString(void)" (??1SAString@@QAE@XZ) referenced in function _main
1>sparta1.obj : error LNK2019: unresolved external symbol "public: void __thiscall SAConnection::Connect(class SAString const &,class SAString const &,class SAString const &,enum SAClient_t,void (__cdecl*)(class SAConnection &,enum SAConnectionHandlerType_t))" (?Connect@SAConnection@@QAEXABVSAString@@00W4SAClient_t@@P6AXAAV1@W4SAConnectionHandlerType_t@@@Z@Z) referenced in function _main
1>sparta1.obj : error LNK2019: unresolved external symbol "public: __thiscall SAString::SAString(char const *)" (??0SAString@@QAE@PBD@Z) referenced in function _main
1>sparta1.obj : error LNK2019: unresolved external symbol "public: void __thiscall SAConnection::setClient(enum SAClient_t)" (?setClient@SAConnection@@QAEXW4SAClient_t@@@Z) referenced in function _main
1>sparta1.obj : error LNK2019: unresolved external symbol "public: __thiscall SACommand::SACommand(void)" (??0SACommand@@QAE@XZ) referenced in function _main
1>sparta1.obj : error LNK2019: unresolved external symbol "public: __thiscall SAConnection::SAConnection(void)" (??0SAConnection@@QAE@XZ) referenced in function _main
1>C:\Users\Vani\Documents\Visual Studio 2005\Projects\sparta1\Debug\sparta1.exe : fatal error LNK1120: 9 unresolved externals
1>Build log was saved at "file://c:\Users\Vani\Documents\Visual Studio 2005\Projects\sparta1\sparta1\Debug\BuildLog.htm"
1>sparta1 - 10 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
|
|
|
|
|
Linker error again - you need to link against whatever provides SAConnection, SAClient etc - would that be what you've included in SQLAPI.h?
Find the right library and tell the linker to look in it and you'll get rid of all those errors in one go!
|
|
|
|
|
yeap..the #include" SQLAPI.h" library contains the linker to SAConnection and SAClient.
|
|
|
|
|
the linker error is not resolved even after including the SQLAPI header file..
|
|
|
|
|
Noooo - you need to LINK against the SQLAPI LIBRARY file - you were already #includeing the header file.
|
|
|
|
|
Ohhh...Finally got it now...the linker errors have been resolved one shot. I have another question,
what does 'try' block starting on line '34' has no catch handlers means??not so familiar with this statement...
|
|
|
|
|
vanishaa wrote: what does 'try' block starting on line '34' has no catch handlers means
a) Which line 34? I haven't seen a try block anywhere.
b) A try block with no catch handlers means someone's forgotten to put catch handlers in...In fact, g++4.0.1 (the only C++ compiler I've got to hand) won't compile a try block with no handlers (what C++ compiler are you using? VC6?)
|
|
|
|
|
If I double click a file into explorer that has the right extension then my app is lounced, and the command line (see __argc and __targv) is like this:
C:\MyApp.exe /dde
What is "/dde " ?
I was expecting the name of the file.... i.e. something like this
C:\MyApp.exe C:\testfile.txt
Any help?
How can I get the filename I need?
Russell
|
|
|
|
|
Russell' wrote: What is "/dde" ?
Dynamic Data Exchange. Check your app's associated extension (and type) in the registry.
Russell' wrote: Any help?
How can I get the filename I need?
Again in the registry, you'll need %1 added to the end of your app's command line.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Yes!!! you are right.
Solved...but only temporary, because every time that my app is closed it is restored the same old/bad values into the registry.
My application is a MDI MFC program.
Some days ago I edited the String into the resource named MIDMYAPPTYPE .
I'm seeing that that string is passed to the constructor CMultiDocTemplate
(into InitInstance of the application).
That day I was surprised that the files where drawed into explorer with the same icon of the app.
I'm thinking that it is there that the app is automatically linked to the extension that I'm using with the program. And every time the program is lounced the same setting are stored.
Can it be true? Do you know how can I avoid this problem?
Russell
|
|
|
|
|
hi, everyone.
Other posts appear very quickly, it's harder to find my previous one related to
this question, so I decide to post this one:
Is the following code legal, for example:
typedef struct _VECTOR {
long a;
} _VECTOR, *_PVECTOR;
since I know:
typedef int int;
is illegal, but the 'typedef struct' example mentioned above is legal at least in
mingw2.95.
Is it possible to get an error from some other compilers that there's a
'typedef redefinition'?
Thanks in advance.
|
|
|
|
|
It is legal.
BTW: have you tried to compile it (with a compiler other that mingw2.95 )?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I've tried with Dev C++, but I cannot remember its version, and I got
'typedef redefinition' when compiling a C++ unit, so I think it may be
possible in C compilation, although it's passed with VC6.0.
Most of the problems I run accoss owed to VC6.0's language extension,
the project created in that environment successfully got countless errors
and warnings in gcc, there were even some 'syntax errors', so I had to make
the transition to a more stricted one.
|
|
|
|
|
It's legal - a tag name is not a type name. Struct, union and enum tag names share one namespace, while type names all share a different namespace. This means that typenames can be the same as tag names.
That means that your example is legal, but the following isn't, as the three tag names (for the struct, union and enum) are all the same:
typedef struct _VECTOR {} _VECTOR;
union _VECTOR {};
enum _VECTOR {};
|
|
|
|
|
yeah, I got the definition,
owe you one.
|
|
|
|
|
Hi,
Your code is valid C code, whether it is legal I can not say.
Normal C compilers will accept it; the odd one that would not, would be wrong.
|
|
|
|
|
hi experts i installed a s/w called QD developed in vc++ 1.52.it is installed successfully and running properly.i have compete code for QD s/w.when i building exe from code and run it is not executing properly.
but same exe when i copied in installed path it is executing successfully...what is the reason how to resolve it?
kir_MFC
|
|
|
|
|
kir_MFC wrote: urgrntly required
- 'required' is rude.
- 'urgently required' is even ruder.
- 'urgrntly requred' is... a typo.
BTW: The executable has some dependecies. It may find them in the installation path.
What do you want 'to resolve' (i.e. It works at should be, in my opinion...)?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: # 'required' is rude.
# 'urgently required' is even ruder.
# 'urgrntly requred' is... a typo.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Hi guys,
I been working on a antivirus project as my final year project.. i have some problem with getting the list of all the files in a directory..
Lets say i choose C:/ and i want the list of all the files in the directory. Kindly help me with this ya... its a console program and i using DavC++ compiler...
Regards,
Thilek
|
|
|
|