#Getting curl to work with visual studio?

254 messages ยท Page 1 of 1 (latest)

slim stratusBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

forest bay
#

#pragma comment( lib, "libcurl")

muted tree
#

Shouldn't the linker do the same thing with the lib I added?

forest bay
#

did you #define CURL_STATICLIB 1

orchid briar
#

is it same?

orchid briar
muted tree
orchid briar
#

sure, also in the visual studio project you will need to include the lib folder in linker options

muted tree
#

I did that already I think

orchid briar
#

try then

muted tree
#

the pragma says it cannot open file as well

#

is that because the file is called libcurl.a

orchid briar
#

ok then you didn't

muted tree
orchid briar
#

oh then you have the wrong lib

#

it is for linux .a

muted tree
#

oh x.x

#

i thought i downloaded the windows one

#

for some reason their windows one has .a extensions

orchid briar
muted tree
orchid briar
#

no i don't think so, i used curl also

muted tree
#

this 64 bit one has .a

#

I can try urt download link one sec

orchid briar
#

let me see

muted tree
#

oh

#

same link

orchid briar
#

wait a sec

#

maybe the fastest way is to compile libcurl with cmake in visual studio

#

in x64 release and debug

muted tree
#

Ive never used cmake I can try rq

orchid briar
#

you will get .lib compiled from visual studio

#

and also .dll and .h

#

download the zip curl

muted tree
#

I find the hardest part of learning c++ to be building applications to start from lol

#

alr one sec lemme do all that rq

orchid briar
#

if you learn this, you can do much more than before

muted tree
#

btw off topic bu do you know if the clr empty project using .net framework is good for creating c++ applications, I am familiar with the c# windows form application but I wanted to create a c++ application to be faster and just to learn really?

orchid briar
#

in c++ if you want to create gui application i suggest to work with other frameworks like QT

#

otherwise if you want to work with windows.h library and gdi+, mfc is still existent but it needs to die

muted tree
#

I saw qt when i was reasearching what frameworks to work with wasn't sure if it was the best or not or ideal for what i wanted

orchid briar
#

but just to learn something new

orchid briar
muted tree
#

Ill try it out after i finish making this project lol

orchid briar
#

it is also cross platform

muted tree
#

oh thats good

#

can I open this curl folder inside of an existing project

#

will cmake just configure it from there?

orchid briar
#

i created some time ago a game launcher in qt quick (private repo) with also libcurl and other libs

muted tree
#

thats cool af fr I just wanted to create like a cool design

#

with ofc like some cool fns lol

orchid briar
#

then it should do automatically

muted tree
#

I made this design in windows form

orchid briar
#

open the folder from visual studio

muted tree
#

based off some other thing i made in a lua project lol

orchid briar
#

windows form is pretty bad

muted tree
#

yeah its annoying to work with

orchid briar
#

you want to do better things you will need to write custom controls

muted tree
#

I literally just wanted to create a minimize animation to the taskbar and its so annoying to do

orchid briar
#

with gdi+ or direct2d

#

it is a pain to do a simple custom control

muted tree
#

yeah

#

i was going to create a custom slider

#

but it was annoying

orchid briar
#

i had to do some graphs in mfc c++ with gdi+.... 1-2 days for just doing that

muted tree
#

thats hell fr

orchid briar
#

because of the bugs and unexpected behaviour of mfc

muted tree
#

also javascript is really easy to write frontend with so I should def try qt

orchid briar
#

try this libcurl and let me know

#

it is kinda javascript

muted tree
#

alr can I just open the folder in an existing project will it just configure that project?

orchid briar
#

you write the interface in qml files that you can customize with QT Creator

muted tree
orchid briar
#

then there are ways to connect c++ functions to javascript functions (backend to frontend and viceversa)

muted tree
#

is that bad lol

orchid briar
#

if it does finish then no

muted tree
#

it did finish just now

#

so ig not lol

orchid briar
#

with success?

#

print the console log

muted tree
orchid briar
#

ok it should be fine

muted tree
#

dont mind the

#

random numbers

orchid briar
#

now up on the visual studio bar

muted tree
#

lmao

orchid briar
#

compilation i think

#

then "install libcurl"

#

it should be there

#

or compile all

muted tree
orchid briar
#

Build

#

i have not visual studio in english

muted tree
#

is it build all?

orchid briar
#

or install

#

do a screen

muted tree
orchid briar
#

install CURL

muted tree
#

got some errors

orchid briar
#

huh that's a visual studio problem

muted tree
#

hmm

orchid briar
#

try build all

muted tree
#

they both error with no supported target architecture

orchid briar
#

ok wait a sec

#

let's return to the original pragma

#

write #pragma comment( lib, "libcurl.a")

#

and let's see if it works

#

because maybe they renamed wrongly..

muted tree
#
#include <iostream>
#include <curl/curl.h>

#pragma comment( lib, "libcurl.a")

int main() {
    CURL *curl;
    CURLcode result;

    curl = curl_easy_init();

    if (curl == NULL) {
        fprintf(stderr, "HTTP request failed\n");
        return -1;
    }

    curl_easy_setopt(curl, CURLOPT_URL, "https://www.google.com");
    result = curl_easy_perform(curl);

    if (result != CURLE_OK) {
        fprintf(stderr, "Error: %s\n", curl_easy_strerror(result));
        return -1;
    }

    curl_easy_cleanup(curl);

    return 0;
}
#

this is right?

orchid briar
#

yes it is

#

it is a curl mistake

muted tree
#

im not sure its erroring still

#

should I switch to a previous vers

orchid briar
#

yes but i don't think you will find the precompiled

#

let's do another thing

muted tree
#

hm?

orchid briar
#

and go to project options

#

cmake project options

muted tree
#

I dont see cmake in it

orchid briar
#

do a screen

muted tree
orchid briar
#

not this

#

libcurl folder of visual studio

muted tree
#

the curl folder I have installed on my pc?

#

i dont have a curl folder inside of vs

orchid briar
#

nono i meant, return to the visual studio that you opened before onto the curl folder

muted tree
#

oh

#

i closed it let me reopen it rq

orchid briar
#

ok

orchid briar
muted tree
#

it says build stopped at the bottom?

orchid briar
#

i can build it

#

maybe you are missing something in visual studio

muted tree
#

hmm im not sure what id be missing

#

i have cmake installed

orchid briar
#

do you have windows 10 SDK?

#

and windows 11 SDK?

muted tree
#

i have 11

#

not 10

orchid briar
#

and you have windows 11 right?

muted tree
orchid briar
#

it should be the same

muted tree
#

ye

orchid briar
#

ok

muted tree
#

all of thoes arent checked

#

why are there two diff 11 ones

orchid briar
#

do you have Widnows Universal CRT SDK?

muted tree
#

is it one of thoes

#

i cant see the full names lol

orchid briar
#

do you have visual studio 2022?

muted tree
#

yeah

orchid briar
#

download v143

muted tree
#

whats 143

orchid briar
#

c++ v143

#

it is build tools

#

for visual studio 2022

#

MSVC

#

you will need that

muted tree
#

oh

#

is it a interal download thing

#

or external

orchid briar
#

internal, just check it

#

it will start downloading it

orchid briar
#

C++ (v143)

muted tree
#

o

orchid briar
#

check it

muted tree
#

downloading it

#

why does the sdk kit have multiple windows 11

#

downloads

#

do i only need 1 of them

orchid briar
#

yes

muted tree
#

o

orchid briar
#

those are different versions

muted tree
#

o

orchid briar
#

you need just one

muted tree
#

alr

#

this is installing

orchid briar
#

let me know

muted tree
#

alright it finished downloading

#

should I try to build the cmake project again?

orchid briar
#

yep

muted tree
#

it still says it failled

#

same issue

orchid briar
#

๐Ÿ˜ฆ

muted tree
#

fax

#

lol

orchid briar
#

there is something wrong on visual studio

muted tree
#

im not even sure what it could be

orchid briar
#

do you have this selected?

muted tree
#

yeah

orchid briar
muted tree
#

.

#

i thought i selected it

#

what did i install then x.x

orchid briar
#

ahahaha

muted tree
#

welp time to wait for this to install again lmao

#

it installed really fast

#

hopefully thats not a bad sign

#

now its not even starting cmake

orchid briar
#

i will reinstall all again visual studio

#

because something is corrupted

#

probably

muted tree
#

probally

#

how do I start the cmake with a folder open?

#

I wanna try it one last time before completly reinstalling

#

I opened the folder but its not running cmake

#

atm

orchid briar
#

some kinda of bug

muted tree
#

is there no way to start cmake with the folder being there?

orchid briar
#

Try to build it

muted tree
#

the build tab is gone for some reason lol

orchid briar
#

reinstall

muted tree
#

ill reinstall in a bit and then ill msg if it worked I have to do some stuff right now

orchid briar
#

๐Ÿ‘

forest bay
#

you know win32 already can do HTTP(S) curl not needed.

muted tree
#

i mean no ididn't know that i'll probally try to use that after I get curl working atp its just a matter of me wanting to get it working anyway im back now so im gonna reinstall rq

muted tree
#

I reinstalled and it is stil lfailing with the same error no supported target architecture

copper flicker
forest bay
#

yeah, getting curl working is still a good option. (cross platform too)

#

just looking at my /c/libs/libcurl i built it from the git repo on windows using msvc2022. which made a libcurl.dll file

#

i followed the build instructions on the github page

#

i dont recall having any issues

muted tree
copper flicker
muted tree
#

i uninstalled it

#

and removed from path env

#

var

muted tree
slim stratusBOT
#

Thank you and let us know if you have any more questions!

This thread is now set to auto-hide after an hour of inactivity