Click here to Skip to main content
15,878,852 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have been scouring the internet and six different books (half c++, half sql) and have been unable to find even one solution that is without errors. I have been searching, copying, writing, editing, mixing, matching, downloading, copying, pasting, and everything-else-ing I can think of for the last three days. I have tried SQLAPI++, but cannot figure out how to get it working after a certain point. No matter what I try, I get "error LNK20..: unresolved external symbol ...", with the fewest number of errors being 1 and the most being 23. Any specific help, walkthroughs, books I can order, code examples I could go by, project parameters, or anything at all would be immensely helpful. I can't waste too much more time on this part of the project. If it would be helpful to post some of my code, please ask, but right now it isn't much.
Posted
Comments
PIEBALDconsult 23-Jul-14 16:05pm    
So, what's the "unresolved external symbol"?
ASINewbie 23-Jul-14 16:14pm    
One of the errors I was getting before was like this one:
error LNK2001: unresolved external symbol "public: class SAString __thiscall SAException::ErrText(void)const " (?ErrText@SAException@@QBE?AVSAString@@XZ)

I would get 10 to 13 similar errors at a time: public: __thiscall SAString::~SAString(void), public: __thiscall SAString::operator char const *(void)const , public: void __thiscall SAConnection::Rollback(void), and so on.

Currently, I'm getting only one error:
error C2664: 'SQLDriverConnectW' : cannot convert parameter 3 from 'SQLCHAR *' to 'SQLWCHAR *'
Jochen Arndt 24-Jul-14 3:15am    
The last error is just an ANSI / Unicode string mismatch. You have two options:
1. Call The ANSI function version SQLDriverConnect()
2. Pass an Unicode string (SQLWCHAR* which is wchar_t*) to SQLDriverConnectW()

The unresolved external errors are usually indicating that the library containing the functions is not linked to your application (sqlapi[s][d].lib in your case). See also the SQLAPI++ FAQ at http://www.sqlapi.com/Support/FAQ.html.
ASINewbie 24-Jul-14 8:50am    
Thanks. This helped out a great deal. I got it working.
KarstenK 24-Jul-14 3:20am    
plz show us the full error list in the future. If you can read LINK 2001 "unresolved symobol" - it really could be a unresolved symbol: you forgot something. Sad but true :-O

1 solution

Plz read and work trough the documentation and the How To Examples of SQLAPI++.
 
Share this answer
 
Comments
ASINewbie 25-Jul-14 14:35pm    
I have gone a completely different rout with the project. SQLAPI++ was proving to be more pain than help. Currently, I'm experiencing a syntax error that I can't figure out, largely because I haven't touched any programming language in years and have had this project suddenly put on me at work. Connecting to a sql database using c++ is something very new to me. The SQLAPI++ files were killing me because I had no idea how to actually use them, or which ones to use at all. I am currently at a much lower level of skill than the task at hand calls for. But I'm also the only one with my company who has any chance of figuring it out right now.
My current issue is here:
http://www.codeproject.com/Questions/800849/SQL-Server-via-Cplusplus-Error-Incorrect-syntax-ne?arn=0
If you could offer any help on this problem, I would be greatly appreciative! Thank you for your help so far.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900