libcurl u VS 2013

libcurl u VS 2013

offline
  • BooU 
  • Novi MyCity građanin
  • Pridružio: 22 Jun 2012
  • Poruke: 5

Da li je neko uspeo naterati cURL da proradi u VS2013?
Bilo kakva potencijalna pomoc ce dobro doci.

dakle:
1. skinula sa sajta curl.haxx.se/download.html Win64
2. Project|Project Properties|VC++ Directories|Include Directories| i dodala putanju do include
3. Project|Project Properties|Linker|General|Additional Library Directories| i dodala putanju do direktorijuma gde je .dll

bilduje se bez greske, ubacim #include<curl/curl.h> i to se bilduje ali kad ubacim kod koji je prvi osnovni primer korisnjeca cURL izbacuje mi greske.

Molim Vas pomozite Smile



Registruj se da bi učestvovao u diskusiji. Registrovanim korisnicima se NE prikazuju reklame unutar poruka.
offline
  • Programer
  • Pridružio: 23 Maj 2012
  • Poruke: 4575

Koje greške izbacuje?



offline
  • BooU 
  • Novi MyCity građanin
  • Pridružio: 22 Jun 2012
  • Poruke: 5

Napisano: 24 Avg 2015 17:48

E.L.I.T.E. ::Koje greške izbacuje?
error LNK2019: unresolved external symbol __imp_curl_easy_init referenced in function "public: virtual void __cdecl SimpleHandler::OnBeforeClose(class CefRefPtr<class CefBrowser>)" (?OnBeforeClose@SimpleHandler@@UEAAXV?$CefRefPtr@VCefBrowser@@@@@Z)

Dopuna: 24 Avg 2015 19:04

Mozda se pomoci ako objavim kod. Smile

#include "cefsimple/simple_handler.h" #include <sstream> #include <string> #include "include/base/cef_bind.h" #include "include/cef_app.h" #include "include/wrapper/cef_closure_task.h" #include "include/wrapper/cef_helpers.h" #include <curl/curl.h> namespace { SimpleHandler* g_instance = NULL; }  // namespace SimpleHandler::SimpleHandler()     : is_closing_(false) {   DCHECK(!g_instance);   g_instance = this; } SimpleHandler::~SimpleHandler() {   g_instance = NULL; } // static SimpleHandler* SimpleHandler::GetInstance() {   return g_instance; } void SimpleHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser) {   CEF_REQUIRE_UI_THREAD();   // Add to the list of existing browsers.   browser_list_.push_back(browser); } bool SimpleHandler::DoClose(CefRefPtr<CefBrowser> browser) {   CEF_REQUIRE_UI_THREAD();   // Closing the main window requires special handling. See the DoClose()   // documentation in the CEF header for a detailed destription of this   // process.   if (browser_list_.size() == 1) {     // Set a flag to indicate that the window close should be allowed.     is_closing_ = true;   }   // Allow the close. For windowed browsers this will result in the OS close   // event being sent.   return false; } void SimpleHandler::OnBeforeClose(CefRefPtr<CefBrowser> browser) {   CEF_REQUIRE_UI_THREAD();   {      CURL *curl;      CURLcode res;      curl = curl_easy_init();      if (curl) {         curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:5000/shutdown");         res = curl_easy_perform(curl);         /* always cleanup */         curl_easy_cleanup(curl);   // Remove from the list of existing browsers.   BrowserList::iterator bit = browser_list_.begin();   for (; bit != browser_list_.end(); ++bit) {     if ((*bit)->IsSame(browser)) {       browser_list_.erase(bit);       break;     }   }   if (browser_list_.empty()) {     // All browser windows have closed. Quit the application message loop.     CefQuitMessageLoop();   } } void SimpleHandler::OnLoadError(CefRefPtr<CefBrowser> browser,                                 CefRefPtr<CefFrame> frame,                                 ErrorCode errorCode,                                 const CefString& errorText,                                 const CefString& failedUrl) {   CEF_REQUIRE_UI_THREAD();   // Don't display an error for downloaded files.   if (errorCode == ERR_ABORTED)     return;   // Display a load error message.   std::stringstream ss;   ss << "<html><body bgcolor=\"white\">"         "<h2>Failed to load URL " << std::string(failedUrl) <<         " with error " << std::string(errorText) << " (" << errorCode <<         ").</h2></body></html>";   frame->LoadString(ss.str(), failedUrl); } void SimpleHandler::CloseAllBrowsers(bool force_close) {   if (!CefCurrentlyOn(TID_UI)) {     // Execute on the UI thread.     CefPostTask(TID_UI,         base::Bind(&SimpleHandler::CloseAllBrowsers, this, force_close));     return;   }   if (browser_list_.empty())     return;   BrowserList::const_iterator it = browser_list_.begin();   for (; it != browser_list_.end(); ++it)     (*it)->GetHost()->CloseBrowser(force_close); }

Dakle, zelim kada klijent signalizira kraj (pritisne x na prozoru koji se otvori uz pomoc ovom CE Framework-a) da se tada pozove 127.0.0.1:5000/shutdown...

offline
  • Programer
  • Pridružio: 23 Maj 2012
  • Poruke: 4575

BooU ::3. Project|Project Properties|Linker|General|Additional Library Directories| i dodala putanju do direktorijuma gde je .dll

Pokušaj da dodaš punu putanju (znači putanju direktorijuma + ime tog .dll fajla). Takođe proveri i ostale putanje, Visual Studio ne može da linkuje biblioteku pa zato izbacuje ovu grešku. Odradi build pa javi kakvo je stanje Smile

offline
  • BooU 
  • Novi MyCity građanin
  • Pridružio: 22 Jun 2012
  • Poruke: 5

Ista greska opet... Svejedno, hvala Smile

Ko je trenutno na forumu
 

Ukupno su 524 korisnika na forumu :: 7 registrovanih, 1 sakriven i 516 gosta   ::   [ Administrator ] [ Supermoderator ] [ Moderator ] :: Detaljnije

Najviše korisnika na forumu ikad bilo je 3466 - dana 01 Jun 2021 17:07

Korisnici koji su trenutno na forumu:
Korisnici trenutno na forumu: cenejac111, ikan, pacika, Shilok, Smiljke, TBF1D, voja64