Solved

Link errors in VStudio 97

Posted on 1998-05-28
8
953 Views
Last Modified: 2013-11-19
Config:
- VStudio 97 Full install (all files)
- DAO SDK 3.5 installed
- NT 4.0 Server

The code (abbreviated):

//////////////
#include <afxole.h>
#include <dbdao.h>

int main() {
      
      CdbDBEngine engine;

      return EXIT_SUCCESS;
} //end main
//////////////

The problem:
- Output:
--------------------Configuration: pcsupport - Win32 Debug--------------------
Compiling...
main.cpp
Linking...
   Creating library Debug/pcsupport.lib and object Debug/pcsupport.exp
main.obj : error LNK2001: unresolved external symbol "public: __thiscall CdbBSTR::CdbBSTR(unsigned short *)" (??0CdbBSTR@@QAE@PAG@Z)
main.obj : error LNK2001: unresolved external symbol "public: struct IUnknown * __thiscall CdbOleObject::GetInterface(int,int)const " (?GetInterface@CdbOleObject@@QBEPAUIUnknown@@HH@Z)
main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CdbOleObject::OnInterfaceChange(void)" (?OnInterfaceChange@CdbOleObject@@UAEXXZ)
main.obj : error LNK2001: unresolved external symbol "public: __thiscall CdbOleObject::CdbOleObject(void)" (??0CdbOleObject@@QAE@XZ)
main.obj : error LNK2001: unresolved external symbol "public: class CdbOleObject & __thiscall CdbOleObject::operator=(class CdbOleObject &)" (??4CdbOleObject@@QAEAAV0@AAV0@@Z)
main.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall CdbOleObject::~CdbOleObject(void)" (??1CdbOleObject@@UAE@XZ)
main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CdbStaticCollection::Refresh(void)" (?Refresh@CdbStaticCollection@@UAEXXZ)
main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CdbStaticCollection::Delete(char const *)" (?Delete@CdbStaticCollection@@UAEXPBD@Z)
main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CdbStaticCollection::ObAppend(class CdbObject &)" (?ObAppend@CdbStaticCollection@@UAEXAAVCdbObject@@@Z)
main.obj : error LNK2001: unresolved external symbol "public: virtual long __thiscall CdbStaticCollection::GetCount(void)" (?GetCount@CdbStaticCollection@@UAEJXZ)
main.obj : error LNK2001: unresolved external symbol "public: virtual class CdbObject  __thiscall CdbStaticCollection::ObItem(long)" (?ObItem@CdbStaticCollection@@UAE?AVCdbObject@@J@Z)
main.obj : error LNK2001: unresolved external symbol "public: virtual class CdbObject  __thiscall CdbStaticCollection::ObItem(char const *)" (?ObItem@CdbStaticCollection@@UAE?AVCdbObject@@PBD@Z)
main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CdbDynamicCollection::Refresh(void)" (?Refresh@CdbDynamicCollection@@UAEXXZ)
main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CdbDynamicCollection::Delete(char const *)" (?Delete@CdbDynamicCollection@@UAEXPBD@Z)
main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CdbDynamicCollection::ObAppend(class CdbObject &)" (?ObAppend@CdbDynamicCollection@@UAEXAAVCdbObject@@@Z)
main.obj : error LNK2001: unresolved external symbol "public: virtual long __thiscall CdbDynamicCollection::GetCount(void)" (?GetCount@CdbDynamicCollection@@UAEJXZ)
main.obj : error LNK2001: unresolved external symbol "public: virtual class CdbObject  __thiscall CdbDynamicCollection::ObItem(long)" (?ObItem@CdbDynamicCollection@@UAE?AVCdbObject@@J@Z)
main.obj : error LNK2001: unresolved external symbol "public: virtual class CdbObject  __thiscall CdbDynamicCollection::ObItem(char const *)" (?ObItem@CdbDynamicCollection@@UAE?AVCdbObject@@PBD@Z)
main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CdbConnections::Refresh(void)" (?Refresh@CdbConnections@@UAEXXZ)
main.obj : error LNK2001: unresolved external symbol "public: virtual long __thiscall CdbConnections::GetCount(void)" (?GetCount@CdbConnections@@UAEJXZ)
main.obj : error LNK2001: unresolved external symbol "public: virtual class CdbObject  __thiscall CdbIndexFields::ObItem(long)" (?ObItem@CdbIndexFields@@UAE?AVCdbObject@@J@Z)
main.obj : error LNK2001: unresolved external symbol "public: virtual class CdbObject  __thiscall CdbIndexFields::ObItem(char const *)" (?ObItem@CdbIndexFields@@UAE?AVCdbObject@@PBD@Z)
main.obj : error LNK2001: unresolved external symbol "public: __thiscall CdbDBEngine::CdbDBEngine(int,int,char const *,char const *,char const *,long)" (??0CdbDBEngine@@QAE@HHPBD00J@Z)
main.obj : error LNK2001: unresolved external symbol "public: class COleVariant  __thiscall CdbRecordset::GetField(char const *)" (?GetField@CdbRecordset@@QAE?AVCOleVariant@@PBD@Z)
main.obj : error LNK2001: unresolved external symbol "public: void __thiscall CdbRecordset::SetField(char const *,struct tagVARIANT *)" (?SetField@CdbRecordset@@QAEXPBDPAUtagVARIANT@@@Z)
main.obj : error LNK2001: unresolved external symbol "public: __thiscall CdbException::CdbException(long)" (??0CdbException@@QAE@J@Z)
main.obj : error LNK2001: unresolved external symbol "public: class CdbWorkspace  __thiscall CdbWorkspaces::operator[](long)" (??ACdbWorkspaces@@QAE?AVCdbWorkspace@@J@Z)
main.obj : error LNK2001: unresolved external symbol "public: class CdbWorkspace  __thiscall CdbWorkspaces::operator[](char const *)" (??ACdbWorkspaces@@QAE?AVCdbWorkspace@@PBD@Z)
main.obj : error LNK2001: unresolved external symbol "public: class CdbDatabase  __thiscall CdbDatabases::operator[](long)" (??ACdbDatabases@@QAE?AVCdbDatabase@@J@Z)
main.obj : error LNK2001: unresolved external symbol "public: class CdbDatabase  __thiscall CdbDatabases::operator[](char const *)" (??ACdbDatabases@@QAE?AVCdbDatabase@@PBD@Z)
main.obj : error LNK2001: unresolved external symbol "public: class CdbTableDef  __thiscall CdbTableDefs::operator[](long)" (??ACdbTableDefs@@QAE?AVCdbTableDef@@J@Z)
main.obj : error LNK2001: unresolved external symbol "public: class CdbTableDef  __thiscall CdbTableDefs::operator[](char const *)" (??ACdbTableDefs@@QAE?AVCdbTableDef@@PBD@Z)
main.obj : error LNK2001: unresolved external symbol "public: class CdbQueryDef  __thiscall CdbQueryDefs::operator[](long)" (??ACdbQueryDefs@@QAE?AVCdbQueryDef@@J@Z)
main.obj : error LNK2001: unresolved external symbol "public: class CdbQueryDef  __thiscall CdbQueryDefs::operator[](char const *)" (??ACdbQueryDefs@@QAE?AVCdbQueryDef@@PBD@Z)
main.obj : error LNK2001: unresolved external symbol "public: class CdbField  __thiscall CdbFields::operator[](long)" (??ACdbFields@@QAE?AVCdbField@@J@Z)
main.obj : error LNK2001: unresolved external symbol "public: class CdbField  __thiscall CdbFields::operator[](char const *)" (??ACdbFields@@QAE?AVCdbField@@PBD@Z)
main.obj : error LNK2001: unresolved external symbol "public: class CdbGroup  __thiscall CdbGroups::operator[](long)" (??ACdbGroups@@QAE?AVCdbGroup@@J@Z)
main.obj : error LNK2001: unresolved external symbol "public: class CdbGroup  __thiscall CdbGroups::operator[](char const *)" (??ACdbGroups@@QAE?AVCdbGroup@@PBD@Z)
main.obj : error LNK2001: unresolved external symbol "public: class CdbUser  __thiscall CdbUsers::operator[](long)" (??ACdbUsers@@QAE?AVCdbUser@@J@Z)
main.obj : error LNK2001: unresolved external symbol "public: class CdbUser  __thiscall CdbUsers::operator[](char const *)" (??ACdbUsers@@QAE?AVCdbUser@@PBD@Z)
main.obj : error LNK2001: unresolved external symbol "public: class CdbDocument  __thiscall CdbDocuments::operator[](long)" (??ACdbDocuments@@QAE?AVCdbDocument@@J@Z)
main.obj : error LNK2001: unresolved external symbol "public: class CdbDocument  __thiscall CdbDocuments::operator[](char const *)" (??ACdbDocuments@@QAE?AVCdbDocument@@PBD@Z)
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
Debug/pcsupport.exe : fatal error LNK1120: 44 unresolved externals
Error executing link.exe.

pcsupport.exe - 45 error(s), 0 warning(s)

---

My reaction: ooph.

I have no clue how this happens since I only include MS libraries. afxole.h is from the directory \VC\MFC\INCLUDE, dbdao.h is from \DAOSDK\INCLUDE (specified in the options dialog box)

This is probably a very simple thing, so please help me out...

(for the interested:
This code:

//////////////
#include <afx.h>  // <-- NOTE THE DIFFERENCE
#include <dbdao.h>

int main() {
      
      CdbDBEngine engine;

      return EXIT_SUCCESS;
} //end main
//////////////

yields:

--------------------Configuration: pcsupport - Win32 Debug--------------------
Compiling...
main.cpp
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(314) : error C2501: 'interface' : missing decl-specifiers
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(314) : error C2239: unexpected token 'identifier' following declaration of 'interface'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(314) : error C2061: syntax error : identifier '_DAODBEngine'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(315) : error C2501: 'interface' : missing decl-specifiers
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(315) : error C2086: 'interface' : redefinition
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(315) : error C2239: unexpected token 'identifier' following declaration of 'interface'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(315) : error C2061: syntax error : identifier 'DAOError'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(316) : error C2501: 'interface' : missing decl-specifiers
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(316) : error C2086: 'interface' : redefinition
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(316) : error C2239: unexpected token 'identifier' following declaration of 'interface'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(316) : error C2061: syntax error : identifier 'DAOErrors'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(317) : error C2501: 'interface' : missing decl-specifiers
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(317) : error C2086: 'interface' : redefinition
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(317) : error C2239: unexpected token 'identifier' following declaration of 'interface'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(317) : error C2061: syntax error : identifier 'DAOProperty'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(318) : error C2501: 'interface' : missing decl-specifiers
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(318) : error C2086: 'interface' : redefinition
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(318) : error C2239: unexpected token 'identifier' following declaration of 'interface'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(318) : error C2061: syntax error : identifier 'DAOProperties'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(319) : error C2501: 'interface' : missing decl-specifiers
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(319) : error C2086: 'interface' : redefinition
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(319) : error C2239: unexpected token 'identifier' following declaration of 'interface'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(319) : error C2061: syntax error : identifier 'DAOWorkspace'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(320) : error C2501: 'interface' : missing decl-specifiers
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(320) : error C2086: 'interface' : redefinition
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(320) : error C2239: unexpected token 'identifier' following declaration of 'interface'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(320) : error C2061: syntax error : identifier 'DAOWorkspaces'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(321) : error C2501: 'interface' : missing decl-specifiers
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(321) : error C2086: 'interface' : redefinition
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(321) : error C2239: unexpected token 'identifier' following declaration of 'interface'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(321) : error C2061: syntax error : identifier 'DAOConnection'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(322) : error C2501: 'interface' : missing decl-specifiers
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(322) : error C2086: 'interface' : redefinition
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(322) : error C2239: unexpected token 'identifier' following declaration of 'interface'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(322) : error C2061: syntax error : identifier 'DAOConnections'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(323) : error C2501: 'interface' : missing decl-specifiers
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(323) : error C2086: 'interface' : redefinition
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(323) : error C2239: unexpected token 'identifier' following declaration of 'interface'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(323) : error C2061: syntax error : identifier 'DAODatabase'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(324) : error C2501: 'interface' : missing decl-specifiers
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(324) : error C2086: 'interface' : redefinition
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(324) : error C2239: unexpected token 'identifier' following declaration of 'interface'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(324) : error C2061: syntax error : identifier 'DAODatabases'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(326) : error C2501: 'interface' : missing decl-specifiers
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(326) : error C2086: 'interface' : redefinition
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(326) : error C2239: unexpected token 'identifier' following declaration of 'interface'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(326) : error C2061: syntax error : identifier '_DAOTableDef'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(327) : error C2501: 'interface' : missing decl-specifiers
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(327) : error C2086: 'interface' : redefinition
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(327) : error C2239: unexpected token 'identifier' following declaration of 'interface'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(327) : error C2061: syntax error : identifier 'DAOTableDefs'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(329) : error C2501: 'interface' : missing decl-specifiers
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(329) : error C2086: 'interface' : redefinition
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(329) : error C2239: unexpected token 'identifier' following declaration of 'interface'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(329) : error C2061: syntax error : identifier '_DAOQueryDef'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(330) : error C2501: 'interface' : missing decl-specifiers
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(330) : error C2086: 'interface' : redefinition
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(330) : error C2239: unexpected token 'identifier' following declaration of 'interface'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(330) : error C2061: syntax error : identifier 'DAOQueryDefs'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(331) : error C2501: 'interface' : missing decl-specifiers
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(331) : error C2086: 'interface' : redefinition
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(331) : error C2239: unexpected token 'identifier' following declaration of 'interface'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(331) : error C2061: syntax error : identifier 'DAORecordset'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(332) : error C2501: 'interface' : missing decl-specifiers
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(332) : error C2086: 'interface' : redefinition
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(332) : error C2239: unexpected token 'identifier' following declaration of 'interface'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(332) : error C2061: syntax error : identifier 'DAORecordsets'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(334) : error C2501: 'interface' : missing decl-specifiers
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(334) : error C2086: 'interface' : redefinition
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(334) : error C2239: unexpected token 'identifier' following declaration of 'interface'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(334) : error C2061: syntax error : identifier '_DAOField'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(335) : error C2501: 'interface' : missing decl-specifiers
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(335) : error C2086: 'interface' : redefinition
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(335) : error C2239: unexpected token 'identifier' following declaration of 'interface'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(335) : error C2061: syntax error : identifier 'DAOFields'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(337) : error C2501: 'interface' : missing decl-specifiers
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(337) : error C2086: 'interface' : redefinition
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(337) : error C2239: unexpected token 'identifier' following declaration of 'interface'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(337) : error C2061: syntax error : identifier '_DAOIndex'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(338) : error C2501: 'interface' : missing decl-specifiers
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(338) : error C2086: 'interface' : redefinition
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(338) : error C2239: unexpected token 'identifier' following declaration of 'interface'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(338) : error C2061: syntax error : identifier 'DAOIndexes'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(339) : error C2501: 'interface' : missing decl-specifiers
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(339) : error C2086: 'interface' : redefinition
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(339) : error C2239: unexpected token 'identifier' following declaration of 'interface'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(339) : error C2061: syntax error : identifier 'DAOParameter'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(340) : error C2501: 'interface' : missing decl-specifiers
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(340) : error C2086: 'interface' : redefinition
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(340) : error C2239: unexpected token 'identifier' following declaration of 'interface'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(340) : error C2061: syntax error : identifier 'DAOParameters'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(342) : error C2501: 'interface' : missing decl-specifiers
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(342) : error C2086: 'interface' : redefinition
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(342) : error C2239: unexpected token 'identifier' following declaration of 'interface'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(342) : error C2061: syntax error : identifier '_DAOUser'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(343) : error C2501: 'interface' : missing decl-specifiers
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(343) : error C2086: 'interface' : redefinition
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(343) : error C2239: unexpected token 'identifier' following declaration of 'interface'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(343) : error C2061: syntax error : identifier 'DAOUsers'
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(345) : error C2501: 'interface' : missing decl-specifiers
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(345) : error C2086: 'interface' : redefinition
C:\Program Files\DevStudio\DAOSDK\INCLUDE\dbdaoint.h(345) : fatal error C1003: error count exceeds 100; stopping compilation
Error executing cl.exe.

pcsupport.exe - 102 error(s), 0 warning(s)
---

WHY WHY WHY)

thank you.
0
Comment
Question by:MaDdUCK
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 2

Expert Comment

by:lucidity
ID: 1315705
use

afxdb.h
0
 
LVL 11

Expert Comment

by:mikeblas
ID: 1315706
Unfortunately, lucitidy's answer is wrong: adding an include directive for AFXDB.H won't help the problem at all! AFXDB.H doesn't have anything to do with the DAO Classes. In fact, it's for MFC's OLEDB classes, which are entirely orthogonal to the DAO SDK classes!

And lucidity's suggestion completely ignores the __endthreadex/__beginthreadex errors you're receiving.

You need to link to the DAO library to get your code to work correctly. That'll get rid of all the Cdao* symbols that aren't resolved.

Since you're using MFC in your application, you need to make sure you're using the right version of the runtime libraries. To get rid of the __endthreadex/__beginthreadex errors you're receiving, you need to link with the multithread versions of the runtimes.

This source code:

-- begin file test.cpp --
#include <afxdisp.h>
#include <dbdao.h>

#ifdef _DEBUG
#ifdef _UNICODE
#pragma comment(lib, "ddao35ud.lib")
#else
#pragma comment(lib, "ddao35d.lib")
#endif
#else
#ifdef _UNICODE
#pragma comment(lib, "ddao35u.lib")
#else
#pragma comment(lib, "ddao35.lib")
#endif
#endif

int main()
{
   CdbDBEngine engine;
   return EXIT_SUCCESS;
}

-- end file test.cpp --

will build for any combination of Unicode, non-unicode, Debug, or release using these command lines:

cl /MT test.cpp
cl /MTd test.cpp
cl /MT /D_UNICODE test.cpp
cl /MTd /D_UNICODE test.cpp

Since the IDE gives you similar switches for the same options in the "Project Settings" dialog, you build will work either way. (Of course, the sample code isn't functional, but wasn't your question.)

Note that I adeptly use #pragma comment(lib) to have the compiler automatically tell the linker which versions of the DAO library to use. You could do the same thing on the linker command line, but you'd have to pick the right library name based on the kind of build you're doing. Just as well to do it with pragmas (like MFC does automatically for you, anyhow).

.B ekiM


0
 
LVL 8

Author Comment

by:MaDdUCK
ID: 1315707
I perfectly understand your answer, but I am getting the same 102 errors even with your code. I also just reinstalled Visual Studio so it is configured perfectly.

(if you help me on this, I will remember the other 200 pointer...) -- the code itself is not a problem, but I have to get it to work...
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Author Comment

by:MaDdUCK
ID: 1315708
oops, sorry, that was wrong. I only get these errors now:

/////////////////////
--------------------Configuration: pcsupport - Win32 Debug--------------------
Compiling...
main.cpp
Linking...
   Creating library Debug/pcsupport.lib and object Debug/pcsupport.exp
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
Debug/pcsupport.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

pcsupport.exe - 3 error(s), 0 warning(s)
/////////////////

and I am still clueless.
0
 
LVL 11

Accepted Solution

by:
mikeblas earned 30 total points
ID: 1315709
Like I said previously, the __beginthreadex and __endthreadex come from not specifying the use of the mutlithreaded C Runtime libraries.

If you're using your own makefile or invoking the compiler directly, use the /MT option for release builds and the /MTd option for debug builds.

If you're using the IDE, make sure you set the "Use run-time library" dropdown to "Multithreaded DLL" or "Debug Multithreaded DLL" (as appropriate for your build type) in the "Code Generation" category of the "C/C++" tab of the "Project Settings" dialog.

If you're using the IDE, all of the correct settings should've been made for you automatically when you set "Using MFC in a static library" or "Using MFC in a shared DLL" in the "Microsoft Foundation Classes" dropdown on the "General" tab of the "Project Settings" dialog.

.B ekiM
0
 
LVL 8

Author Comment

by:MaDdUCK
ID: 1315710
Very nice. Thank you. I am glad that the cooperation has indeed worked out. I ask you to answer the other thread, but I would likt to keep it ungraded for a week or so until I have a basic framework developed, so that can ask questions (simple ones) if need be.

One question at this point (answer it if you feel like it)
Am I correct in assuming that "MFC as static DLL" will include the DLL in my exe, thus increasing its size and making it independent of the DLL, whereas "MFC as shared DLL" will use the mfc*.dll files in my \winnt\system32 directory?

Thank you.
0
 
LVL 11

Expert Comment

by:mikeblas
ID: 1315711
There's no such choices as "static DLL". The phrase "static DLL" is an oxymoron.

Like the documentation explains, "MFC as a static library" bakes MFC into your executable. Your executable is larger, but you're not dependent on the MFC*.DLL files. "MFC in a shared DLL" uses the DLL; your executable is smaller, you're dependent on the DLL, but you might afford some shared code.

Most MFC books (like mine) explain far more details and investigate strategies for deciding which build variant to use.

.B ekiM
0
 

Expert Comment

by:pepperbat
ID: 8597866
This helpled me too!
Thanks
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Error on moodle after upgrade 3 149
Detect CR LF to each line 12 174
zeroFront challenge 7 121
FizzBuzz challenge 9 84
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question