c++curlexternraylibcurlpp

raylib + cURLpp == C2733 you cannot overload a function with 'extern "C" '


I tried making a weather app using cURL for the api request and raylib for the gui and both libraries worked until I combined them.

I thought that there is a mistake in my project configuration so I made a separate project where I only included raylib and cURL/cURLpp without any other code:

#include "raylib.h"
#include "curlpp/cURLpp.hpp"


int main()
{

}

and when I try to compile, I get this output:

Build started at 6:43 PM...
1>------ Build started: Project: weatherCpp, Configuration: Debug x64 ------
1>weatherCpp.cpp
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\winuser.h(4710,1): error C2733: 'CloseWindow': you cannot overload a function with 'extern "C"' linkage
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\winuser.h(9328,1): error C2733: 'ShowCursor': you cannot overload a function with 'extern "C"' linkage
1>Done building project "weatherCpp.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 6:43 PM and took 02.010 seconds ==========

I looked around and I know it's because of functions declared with extern "C" but I dont know what to do about it is there an easy way of fixing this or do I need to switch libraries

*both libraries were downloaded with vcpkg
**using vs 2022


Solution

  • FIXED: I separated the visual studio solution into 2 projects, one was used for cURL (static library) and the other for raylib (.exe). I also put all the cURL code inside a namespace and now I don't get any errors and can create a window with raylib and do https requests with cURL no problem
    This video helped me out
    *Thanks for all the help btw :)