George Elias wrote:
> Hi,
> 
> I'm having some problems when I include curlpp in my own library. This 
> is what I get:
> 
> 
> C:\Projetos\curlpp-0.7.2\curlpp\cURLpp.hpp(66) : error C2065: 
> 'dllimport' : undeclared identifier 
> C:\Projetos\curlpp-0.7.2\curlpp\cURLpp.hpp(66) : error C2182: 
> '__cdeclspec' : illegal use of type 'void' 
> C:\Projetos\curlpp-0.7.2\curlpp\cURLpp.hpp(66) : error C2146: syntax 
> error : missing ';' before identifier 'initialize' 
> C:\Projetos\curlpp-0.7.2\curlpp\cURLpp.hpp(66) : fatal error C1075: end 
> of file found before the left brace '{' at 
> 'C:\Projetos\curlpp-0.7.2\curlpp\cURLpp.hpp(40)' was matched
> 
> I have no idea why this shows up. I built curlpp on Visual Studio 7 as a 
> static library, it compiles fine, the problem is when I'm trying to 
> compile my own library (the one I'm developing).
> 
> Does anyone have any idea why this happens?? I've googled for a couple 
> of days but no luck so far...

George

Line 66 of cURLpp.hpp (actually it's line 64) looks like this
void CURLPPAPI initialize(long flags = CURL_GLOBAL_ALL);

What's important for us in this line is macro CURLPPAPI defined in dllfct.h 
file in this way

/*
 * Decorate exportable functions for Win32 DLL linking.
 * This avoids using a .def file for building libcurl.dll.
 */
#if (defined(WIN32) || defined(_WIN32)) && !defined(CURLPP_STATICLIB)
#if defined(BUILDING_CURLPP)
#define   CURLPPAPI __declspec(dllexport) 
#else
#define   CURLPPAPI __declspec(dllimport) 
#endif
#else
#define CURLPPAPI
#endif

As you see this macro depens on four others; WIN32, _WIN32, CURLPP_STATICLIB 
and BUILDING_CURLPP. The first two (or one of them) is defined if you use VC. 
We must take care about the last two; CURLPP_STATICLIB and BUILDING_CURLPP. 
If you are building some library tht uses the static version of cURLpp you have 
to define CURLPP_STATICLIB (you set this in Project/<Project name> 
properties/Configuration Properties/C/C++/Preprocessor/Preprocessor Definitions.
Also make sure you defined this macro befor building a static cURLpp library 
itself. For corectness you should also define BUILDING_CURLPP befor building 
cURLpp as well.

Good luck!

Regards
Piotr Dobrogost
_______________________________________________
cURLpp mailing list
cURLpp@rrette.com
http://www.rrette.com/mailman/listinfo/curlpp

Reply via email to