I have tried googling, and found no solution to my problem. I’m trying to learn how to use libcurl, a c networking library. I tried compiling a program that was automatically generated from curl, and a few examples i found online but nothing happened. I got no errors or logs, the program stopped “sucessfully” but i get no output. I also cant write to the console either while the library is included.

Any help is appreciated.

  • @[email protected]OP
    link
    fedilink
    327 days ago
    PS C:\Users\USERNAME\3ds> gcc test.c -o test.exe -IC:\Users\22.tom.carroll\scoop\apps\curl\current\include -LC:\Users\22.tom.carroll\scoop\apps\curl\current\lib -lcurl
    PS C:\Users\USERNAMEl\3ds> ./test.exe
    PS C:\Users\USERNAME3ds> ls
    
    
        Directory: C:\Users\USERNAME\3ds
    
    
    Mode                 LastWriteTime         Length Name
    ----                 -------------         ------ ----
    d-----        19/11/2024     20:48                c
    -a----        29/11/2024     21:35           1880 file.c
    -a----        29/11/2024     22:52           1409 test.c
    -a----        29/11/2024     22:52         236221 test.exe
    
    
    PS C:\Users\USERNAME\3ds>
    

    Its not working unfortunatly.

    • @[email protected]
      link
      fedilink
      427 days ago

      Does hello world work? You should’ve gotten at least some console output.

      #include <stdio.h>
      
      int main()
      {
          fprintf(stderr, "Hello world\n");
          return 0;
      }
      
      • @[email protected]OP
        link
        fedilink
        327 days ago

        That works perfectly

        PS C:\Users\username\3ds> gcc test.c -o test.exe 
        PS C:\Users\username\3ds> ./test.exe
            Hello world
        
        
        • @[email protected]
          link
          fedilink
          527 days ago

          Try adding some prints to stderr through my earlier test program then and see if you can find where it stops giving you output. Does output work before curl_easy_init? After it? Somewhere later on?

          Note that I did update the program to add the line with CURLOPT_ERRORBUFFER – that’s not strictly needed, but might provide more debug info if something goes wrong later in the program. (Forgot to add the setup line initially despite writing the rest of it… 🤦‍♂️️)

          You could also try adding curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); to get it to explain more details about what it’s doing internally if you can get it to print output at all.