开发者

How to include ODBC ver 3.0 libraries in my MFC app in Visual C++ 2010?

  1. I created my own ODBC wrapper class which handles SQL from C++ Win32 application.
  2. I have copied and Added (as existing) this class to my MFC application.

Now I have terrible linking problems with unresolved external symbols (which were NOT present in the Win32 perfectly working app), such as this: "

Error 56

error LNK2019: unresolved external symbol _SQLSetStmtAttr@16 referenced in function "public: int __thiscall Cosql::ODBCconnect(char *)" (?ODBCconnect@Cosql@@QAEHPAD@Z)

C:\Documents and Settings.........\Cosql.obj ApplicationName "

How can I PROPERLY include "sqlext.h" (and "sql.h") from

C:\Program Files\Microsoft SDKs\Windows\v7.0A in my MFC application or MORE importantly: How to resolve those external symbols?

Am I the only one trying to ODBC-connect from a MFC app and having this trouble ??? :O

I Just know that "SQLSetStmtAttr" function is there defined only for ODBCVER 3.0 and higher. Well ! But HOW do I set ODBCVER in my MFC app. ??? I have no idea.

EDIT: I figured out that ODBCVER is defined: 0x0380 (so it is ver. 3.8), all functions are defined correctly by those includes: sql.h and sqlext.h ,

EDIT II: Linking ERROR开发者_如何学Python persists when I convert all those methods (object) into pure functions using some global variables!

Thanx in advance.


Solved.

Solution: I created a DLL from my ODBC class and then used it in my project. Now it is compiled independently so it does not restrict each other's INCOMPATIBLE environment and compiler settings anymore!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜