Toost
Toost

Reputation: 21

Why does including a linking path in my GCC compile command with libcurl break compilation?

My goal is to be able to use cJSON and libcurl for a current C project. I am able to use libcurl WITHOUT any linkers/linker path options. When I add the linker path to my GCC compile options, I get a bunch of “unreferenced functions” and other related issues to libcurl not existing.

This is an issue because I NEED to have a linker path in my GCC compile command for cJSON to work. This is my commands:

Error producing command:

#!/usr/bin/env bash

gcc -I/home/arch/coding/vcpkg/installed/x64-linux/include -lcurl \
    -L/home/arch/coding/vcpkg/installed/x64-linux/lib -lcjson \
    main.c -o gitgetn

One that compiles errorless:

#!/usr/bin/env bash

gcc -I/home/arch/coding/vcpkg/installed/x64-linux/include -lcurl \
    main.c -o gitgetn

I’ve tried re-erranging the order of commands with the issue causing one and some versions just give me a BUNCH more errors. This command just breaks libcurl entirely:

gcc main.c  -I/home/arch/coding/vcpkg/installed/x64-linux/include \
    -lcurl -L/home/arch/coding/vcpkg/installed/x64-linux/lib -lcjson \
    -o gitgetn

Upvotes: 0

Views: 43

Answers (0)

Related Questions