This is a source of tremendous anxiety. I can't seem to get it to do anything. I am thinking about just trashing this whole project. Why isn't the linker working?
I have been sitting and look at so many different links, but I don't understand how to resolve it. I know that I have the library installed correctly, but, I can't seem to get it to link. I have the libcurl.dll in System32 file. Yet, I still do not know what to do. I am going mad trying to get it to work. I don't have any files in the Project Options>Directories>Library Directories, Project Options>Directories>Include Directories, or Project Options>Directories>Resource Directories. In the Project Options>Parameters>Linker:
"../Program Files (x86)/Dev-Cpp/MinGW64/lib/libcurl.a"
So, I don't know what else to do. I have been sitting here for about week trying to figure it out on my own. I probably should have asked for help sooner x.x Maybe I am missing files for the libcurl, but I doubt it because I downloaded the whole file. I don't know if it could be my firewall, Norton, blocking it. How would I allow permissions if it is? I have no clue what the problem is. Can someone shed some light on this. I have literally looked at every solution anyone has to offer on here
My MakeFile:
# Project: Project1
# Makefile created by Dev-C++ 5.11
CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
OBJ = Project.o
LINKOBJ = Project.o
LIBS = -L"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib" -L"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib" -static-libgcc "../Program Files (x86)/Dev-Cpp/MinGW64/lib/libcurl.a"
INCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include"
CXXINCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++"
BIN = Project1.exe
CXXFLAGS = $(CXXINCS)
CFLAGS = $(INCS)
RM = rm.exe -f
.PHONY: all all-before all-after clean clean-custom
all: all-before $(BIN) all-after
clean: clean-custom
${RM} $(OBJ) $(BIN)
$(BIN): $(OBJ)
$(CPP) $(LINKOBJ) -o $(BIN) $(LIBS)
Project.o: Project.cpp
$(CPP) -c Project.cpp -o Project.o $(CXXFLAGS)
The Source Code:
#include <curl/curl.h>
#include <iostream>
int main( void )
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://google.com");
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
return 0;
}
The errors that keep popping up:
g++.exe Project.o -o Project1.exe -L"C:/Program Files (x86)/Dev-
Cpp/MinGW64/lib" -L"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-
mingw32/lib" -static-libgcc "../Program Files (x86)/Dev-
Cpp/MinGW64/lib/libcurl.a"
Project.o:Project.cpp:(.text+0x16): undefined reference to `__imp_curl_easy_init'
Project.o:Project.cpp:(.text+0x41): undefined reference to `__imp_curl_easy_setopt'
Project.o:Project.cpp:(.text+0x5c): undefined reference to `__imp_curl_easy_setopt'
Project.o:Project.cpp:(.text+0x6c): undefined reference to `__imp_curl_easy_perform'
Project.o:Project.cpp:(.text+0x83): undefined reference to `__imp_curl_easy_strerror'
Project.o:Project.cpp:(.text+0xb5): undefined reference to `__imp_curl_easy_cleanup'
collect2.exe: error: ld returned 1 exit status
C:\Projects\Makefile.win:25: recipe for target 'Project1.exe' failed
mingw32-make.exe: *** [Project1.exe] Error 1
` tags do nothing four space indentation (or ctrl+k) is the magic for code formatting.
– user4581301 Jun 08 '17 at 04:45