GIDForums  

Go Back   GIDForums > Computer Programming Forums > CPP / C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 12-Jan-2005, 03:19
confused_pig confused_pig is offline
New Member
 
Join Date: Jan 2005
Posts: 7
confused_pig is on a distinguished road

Compiling error when doing SQL database in C++


Hey pplZ, its me again,

I have some compiling errors. Hope u pplez may help...

Linking...
nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in libcpmtd.lib(delop.obj)
Debug/sql.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.


How to debug these errors? ??: ??: Help needed desparately...
  #2  
Old 12-Jan-2005, 19:27
confused_pig confused_pig is offline
New Member
 
Join Date: Jan 2005
Posts: 7
confused_pig is on a distinguished road
This is the code which i found online and had modified it.
While compiling ==> no errors or warning...
BUT Linking ==> 2 errors that i mentioned above...
So hope u guys will help me... desperately in need of help.

CPP / C++ / C Code:
#include <iostream> 
using std::cin; 
using std::cout; 
using std::endl; 
#include <afxwin.h> 
#include <sql.h> 
#include <sqlext.h> 
void main() 
{ 
  // declarations needed for SQL 
  RETCODE rc;        // ODBC return code 
  HENV henv;         // Environment 
  HDBC hdbc;         // Connection handle 
  HSTMT hstmt;       // Statement handle 

  // attempt to connect to the ODBC database 
  char db[] = "myDatabase"; // ODBC database name 
  cout << "Attempting to open database " << db << "..." << endl; 
  SQLAllocEnv(&henv); 
  SQLAllocConnect(henv, &hdbc); 
  rc = SQLConnect(hdbc, (unsigned char*)db, SQL_NTS, 0, 0, 0, 0); 
  // if not successful, quit 
  if ((rc != SQL_SUCCESS) && (rc != SQL_SUCCESS_WITH_INFO)) 
  { 
    cout << "Cannot open database -- make sure ODBC is configured properly." << endl; 
    SQLFreeConnect(hdbc); 
    SQLFreeEnv(henv); 
    cout << "Press ENTER to continue." << endl; 
    cin.get(); 
    return; 
  } 
  // create another SQL statement 
  rc = SQLAllocStmt(hdbc, &hstmt); 
  sql = "SELECT desig,term,units,grade FROM courses"; 
  // execute the SQL statement 
  cout << "Executing " << sql << endl; 
  rc = SQLExecDirect(hstmt, (unsigned char*)sql, SQL_NTS); 
  if ((rc != SQL_SUCCESS) && (rc != SQL_SUCCESS_WITH_INFO)) 
  { 
    // error executing SQL statement 
    SQLCHAR sqlState[8], msgText[1024]; 
    SQLINTEGER NativeErrorPtr; 
    SQLSMALLINT TextLengthPtr; 
    SQLGetDiagRec(SQL_HANDLE_STMT, hstmt, 1, sqlState, 
      &NativeErrorPtr, msgText, sizeof(msgText), &TextLengthPtr); 
    SQLFreeStmt(hstmt, SQL_DROP); 
    SQLDisconnect(hdbc); 
    SQLFreeConnect(hdbc); 
    SQLFreeEnv(henv); 
    cout << "Error  " << endl << msgText << endl; 
    cout << "Press ENTER to continue." << endl; 
    cin.get(); 
    return; 
  } 
  // close database 
  SQLFreeStmt(hstmt, SQL_DROP); 
  SQLDisconnect(hdbc); 
  SQLFreeConnect(hdbc); 
  cout << "Finished. Press ENTER to continue." << endl; 
  cin.get(); 
}

TIA
Last edited by JdS : 15-Jan-2005 at 05:22. Reason: Please insert your example C/C++ codes between [c] and [/c] tags
  #3  
Old 12-Jan-2005, 21:08
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,234
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all
Quote:
Originally Posted by confused_pig
This is the code which i found online and had modified it.
You'd be better off using code tags so your code could be read rather than using colors to try to make your post interestng...

nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)"...
afxmem.obj contains a function called delete...

... already defined in libcpmtd.lib(delop.obj)
which is already defined in the file delop.obj so the compiler hasn't a clue which one to use.

It's kinda like needing to talk to Daryl of Larry, Daryl, and Daryl -- which one do you want, the silent one or the quiet one? ;-)
__________________

Cow: You're a lawyer too?
Mooseblood (mosquito): Ma'am, I was already a bloodsucking parasite. All I needed was a briefcase!
 
 

Recent GIDBlogToyota - 2008 July Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
database search skyloon MySQL / PHP Forum 6 04-Jun-2006 12:09
DiscountASP.NET Launches SQL Reporting Services dasp Web Hosting Advertisements & Offers 0 19-Oct-2004 17:32
cgi txt database to mysql erhanharputlu MySQL / PHP Forum 0 27-Sep-2004 01:30
Easy SQL query jlee MySQL / PHP Forum 1 22-Jul-2004 07:15
[Tutorial] MySQL Basics nniehoff MySQL / PHP Forum 15 23-Mar-2003 19:42

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 00:56.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.