|
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
|
|
|
|
|
Thilek wrote: Need help to get list of files in a directory...
Best answer is FindFirstFile/FindNextFile and other way that its not good using of DlgDirList Function.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Since you are not using VC++ compiler, i'm sticking to pure windows apis. You could use FindFirstFile() and FindNextFile(). Check out this sample[^].
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
JiJO raj,
thanks ya but its still showing 27
C:\Documents and Settings\Thilek\Desktop\2nd_trial\god\main.cpp cannot convert `const WCHAR*' to `const CHAR*' for argument `1' to `void* FindFirstFileA(const CHAR*, _WIN32_FIND_DATAA*)'
i running it on DevC++ since when i run it in VC++ express 2005 many header files missing in its library....
Any suggestions ???
|
|
|
|