Overview
Features
Download
Documentation
Community
Add-Ons & Services

[SOLVED]Strange error when using the poco lib with VC++ 2005

A general discussion forum.

[SOLVED]Strange error when using the poco lib with VC++ 2005

Postby athkou » 30 Sep 2009, 10:09

Hello again. I'm trying to use the Poco MySQL classes with an windows application. The errors that I receive are annoying because the identifiers that the compiler cannot found are functions from the win32 library. The functions are TryEnterCriticalSection and CreateMutex. You might think that I dump on you my troubles but I cannot help myself. This topic and this did not solve my problem. The inclusion order in my project is the following:

In main.cpp:
Code: Select all
#include <windows.h>
#include <commctrl.h>
#include "restest.h"
#include "MySQLDatabase.h"


In MySQLDatabase.h:
Code: Select all
#include <string>
#include "Poco/Data/Common.h"
#include "Poco/Data/Session.h"
#include "Poco/Data/MySQL/Connector.h"


Adding the windows header file in MySQLDatabase.h befor or after the poco includes does not change anything. If I remove MySQLDatabase.h from the project the errors are gone but that is not a solution. Is there a reason for these strange errors, and most important is there any solution?

I am using Visual C++ 2005 Standard edition
Last edited by athkou on 01 Oct 2009, 10:44, edited 1 time in total.
athkou
 
Posts: 5
Joined: 04 Sep 2009, 18:44

Re: Strange error when using the poco lib with Visual C++ 2005

Postby alex » 30 Sep 2009, 11:22

If I recall correctly, sometimes WINVER=0x0500 helps with this.
alex
 
Posts: 1103
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Strange error when using the poco lib with Visual C++ 2005

Postby athkou » 01 Oct 2009, 10:42

Thanks for that hint alex :!: With your help and looking little deeper in the poco library I find a solution that removes my errors. I will post my solution, maybe someone find it useful :lol:
Code: Select all
// In main.h
// Allow use of features W2K and later
#ifndef NTDDI_VERSION     
#define NTDDI_VERSION NTDDI_WIN2K

#endif //NTDDI_VERSION

// Allow use of features W2K and later
#ifndef WINVER           
#define WINVER 0x0500       

#endif //WINVER

// Allow use of features specific to W2K or later
#ifndef _WIN32_WINNT
#define _WIN32_WINNT WINVER   

#endif //_WIN32_WINNT

// needed for CreateMutex
#define POCO_NO_UNWINDOWS


Code: Select all
// In main.cpp

#include "main.h"
#include <windows.h>
// ...
athkou
 
Posts: 5
Joined: 04 Sep 2009, 18:44


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron