1

After implementing 'curl' as a git submodule into my project "myproject" I wrote some code to test it out:

#include "curl/curl.h"

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

    curl = curl_easy_init();
    //CONTINUE CODING HERE ···
    return 0;
}

In Visual Studio 2019 IDE, after pressing the "Local Windows Debugger" button with any configuration and platform, I get the following linking errors in the "Error List" field:

Error LNK1120 1 unresolved externals "myproject\Release\myproject.exe"
Error LNK2001 unresolved external symbol __imp__curl_easy_init "myproject\myproject\main.obj"

The curl include directory has been properly added and installed for all the configurations and platforms though, I get this linking error. Is it possible to do something to fix this using 'curl' as a git submodule?

  • 1
    What about the curl library file? – user253751 Jul 23 '20 at 14:00
  • Does this answer your question? [What is an undefined reference/unresolved external symbol error and how do I fix it?](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – user253751 Jul 23 '20 at 15:19
  • The curl .lib file is not present on the repo. No .lib files in the `/curl/lib` folder (just C source and headers). I don't know if I have to make it manually. Anyways, if I had to to this, wouldn't making my own lib files (with the given tools if any) mess up my submodule? After all, the structure of the submodule must keep its integrity to 100% match the commit in GitHub, must not it? @user253751 –  Jul 23 '20 at 16:21
  • The curl .lib file is something you get by building the library. It's not in github because github only has the source code for the library. You wouldn't put a .exe in your program's github repo, would you? – user253751 Jul 23 '20 at 16:27
  • Mh, I understand. So then does it make sense to have curl as a submodule because of this? I ask this because I assume that the built .lib files must then be in a lib folder external to the submodule @user253751 –  Jul 23 '20 at 16:31
  • Up to you. Try it and see. Most people don't put their libraries as submodules - they just download the .lib and header files from the library's website. (or on Linux, they install them with apt or yum) – user253751 Jul 23 '20 at 16:40

0 Answers0