Ive just installed DEV-C on windows 7 starter and have managed to successfully compile a small c++ program to read an image file and then display it in a window. Im using SFML.
Ive included these references in the project directories:
SFML-2.3.2\include
SFML-2.3.2\lib
However, it wont link. Here is the compile log. It is a bit incomprehensible to me as i am still learning how to use it.
COMPILE LOG:
vbrowse1.o:vbrowse1.cpp:(.text$_ZN2sf6SpriteD1Ev[__ZN2sf6SpriteD1Ev]+0x5e): undefined reference to `_imp___ZN2sf13TransformableD2Ev'
collect2.exe: error: ld returned 1 exit status
HERE IS THE MAKE FILE:
# Project: vbrowse
# Makefile created by Dev-C++ 5.11
CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
OBJ = vbrowse1.o
LINKOBJ = vbrowse1.o
LIBS = -L"C:/Program Files/Dev-Cpp/MinGW64/lib32" -L"C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib32" -static-libgcc -L"C:/SFML-2.3.2/lib" -mwindows -m32
INCS = -I"C:/Program Files/Dev-Cpp/MinGW64/include" -I"C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include" -I"C:/SFML-2.3.2/include"
CXXINCS = -I"C:/Program Files/Dev-Cpp/MinGW64/include" -I"C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include" -I"C:/Program Files/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++" -I"C:/SFML-2.3.2/include"
BIN = vbrowse.exe
CXXFLAGS = $(CXXINCS) -m32
CFLAGS = $(INCS) -m32
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)
vbrowse1.o: vbrowse1.cpp
$(CPP) -c vbrowse1.cpp -o vbrowse1.o $(CXXFLAGS)
C:\eyeball\vbrowse\Makefile.win:25: recipe for target 'vbrowse.exe' failed
mingw32-make.exe: *** [vbrowse.exe] Error 1
Can anyone spot the problem?
Thanks.
Related
I am making a simple Win32 C++ game and when I made a header file and a resource file once I compiled it I had an error message from the compile log wich said "*** missing separator. stop"and it was from the make file in the line that had my new resource file.
This is not the first time I try to make a resource file as I did it with another simple apps and it worked fine but now with this application it didnt work also I checked the makefile from another aplication and they had the same syntax.
Any help would be appreciated.
And by the way im using Dev-Cpp ide and compiler if that may help you find a solution for my problem.
**Edit:**The makefile code is:
# Project: Win32 Game 1
# Makefile created by Dev-C++ 4.9.9.2
CPP = g++.exe -D__DEBUG__
CC = gcc.exe -D__DEBUG__
WINDRES = windres.exe
RES = Win32_Game_#1_private.res
OBJ = WinMain.o $(RES)
LINKOBJ = WinMain.o $(RES)
LIBS = -L"C:/Dev-Cpp/lib" -mwindows -lgmon -pg -g3
INCS = -I"C:/Dev-Cpp/include"
CXXINCS = -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include"
BIN = "Win32 Game 1.exe"
CXXFLAGS = $(CXXINCS) -pg -g3
CFLAGS = $(INCS) -pg -g3
RM = rm -f
.PHONY: all all-before all-after clean clean-custom
all: all-before "Win32 Game 1.exe" all-after
clean: clean-custom
${RM} $(OBJ) $(BIN)
$(BIN): $(OBJ)
$(CPP) $(LINKOBJ) -o "Win32 Game 1.exe" $(LIBS)
WinMain.o: WinMain.cpp
$(CPP) -c WinMain.cpp -o WinMain.o $(CXXFLAGS)
Win32_Game_#1_private.res: Win32_Game_#1_private.rc Settings.rc
$(WINDRES) -i Win32_Game_#1_private.rc --input-format=rc -o Win32_Game_#1_private.res -O coff
Settings.rc is the resource file that im trying to add
the issue is after formatting windows (7 ultimate x64) I have tried to compile with new installation of Dev C++ IDE using mingw32 that's all..
I wonder how typical is this and is it my fault ?
I have tried searching on this issue and not clear from very few results what could be the problem .
...\DevCpp\DevCPPDLLcpp.o DevCPPDLLcpp.cpp:(.text+0x1e): undefined
reference to `_imp__CoTaskMemAlloc#4'
the code is here :
https://stackoverflow.com/a/33238812/1329184
EDIT: added makefile..
x86_64-w64-mingw32/lib32" -static-libgcc -m32
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 = DevCPPDLL.dll
CXXFLAGS = $(CXXINCS) -m32 -DBUILDING_DLL=1
CFLAGS = $(INCS) -m32 -DBUILDING_DLL=1
RM = rm.exe -f
DEF = libDevCPPDLL.def
STATIC = libDevCPPDLL.a
.PHONY: all all-before all-after clean clean-custom
all: all-before $(BIN) all-after
clean: clean-custom
${RM} $(OBJ) $(BIN) $(DEF) $(STATIC)
$(BIN): $(LINKOBJ)
$(CPP) -shared $(LINKOBJ) -o $(BIN) $(LIBS) -Wl,--output-def,$(DEF),--out-implib,$(STATIC),--add-stdcall-alias
I have a problem with the following makefile in Windows. Although it worked in Linux, I get an error now using MinGW in Windows.
I checked the article on this page: Compile using MakeFile in Window, but I still have no success.
CC = c++
CFLAGS = -Wall -g
ODIR = /OBJ
CFILES := $(wildcard SRC/*.cpp)
OFILES := $(addprefix OBJ/,$(notdir $(CFILES:.cpp=.o)))
meshl: $(OFILES)
$(CC) $(CFLAGS) -o $# $(OFILES)
OBJ/%.o: SRC/%.cpp
$(CC) $(CFLAGS) -c $< -o $#
clean:
rm -f OBJ/*.o
When I try to compile it in the command prompt, the following message appears:
OBJ/mpoint.o: file not recognized: File format not recognized
collect2.exe: error: ld returned 1 exit status
makefile:9: recipe for target 'meshl' failed
make: ***[meshl] Error 1
Thanks for your time and help!
I try to compile a simple c file in Dev-C++ and it shows an error on line 25
C:\Users\varun\Desktop\cprog\Makefile.win recipe for target 'Project1.exe' failed.
Makefile.win
# Project: Project1
# Makefile created by Dev-C++ 5.6.2
CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
OBJ = main.o Untitled2.o
LINKOBJ = main.o Untitled2.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
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.8.1/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.8.1/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.8.1/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)
**$(CC) $(LINKOBJ) -o $(BIN) $(LIBS)**
main.o: main.c
$(CC) -c main.c -o main.o $(CFLAGS)
Untitled2.o: Untitled2.c
$(CC) -c Untitled2.c -o Untitled2.o $(CFLAGS)
Errors
C:\Users\varun\Desktop\cprog\Untitled2.o Untitled2.c:(.text+0x0): multiple definition of `main'
C:\Users\varun\Desktop\cprog\main.o main.c:(.text+0x0): first defined here
C:\Users\varun\Desktop\cprog\collect2.exe [Error] ld returned 1 exit status
25 C:\Users\varun\Desktop\cprog\Makefile.win recipe for target 'Project1.exe' failed
The important bit of the output is:
C:\Users\varun\Desktop\cprog\Untitled2.o Untitled2.c:(.text+0x0): multiple definition of `main'
It tells you, that you have two definitions of function main. You need exactly one such definition in an executable. The next line of the error tells you, where that definition is:
C:\Users\varun\Desktop\cprog\main.o main.c:(.text+0x0): first defined here
So you have function main defined in Untitled2.c and you have another function main defined in main.c. Delete one of them. From the names perhaps the main.c is unnecessary altogether, but I can't tell without seeing the files.
I am using Dev C++ v5.5.3
I have just written the code for the program and the makefile was generated by Dev C++.
I don't know anything about Makefiles. Here is the makefile generated by Dev C++.
I keep getting the error "recipe for target 'Dialogs_Private.res' failed".
Please help
# Project: Dialogs
# Makefile created by Dev-C++ 5.5.3
CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
RES = Dialogs_private.res
OBJ = Main.o $(RES)
LINKOBJ = Main.o $(RES)
LIBS = -L"C:/Program Files/Dev-Cpp/MinGW32/lib" -static-libstdc++ -static-libgcc
INCS = -I"C:/Program Files/Dev-Cpp/MinGW32/include"
CXXINCS = -I"C:/Program Files/Dev-Cpp/MinGW32/include"
BIN = Dialogs.exe
CXXFLAGS = $(CXXINCS)
CFLAGS = $(INCS)
RM = rm -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)
Main.o: Main.cpp
$(CPP) -c Main.cpp -o Main.o $(CXXFLAGS)
Dialogs_private.res: Dialogs_private.rc dialogResource.rc
$(WINDRES) -i Dialogs_private.rc --input-format=rc -o Dialogs_private.res -O coff
From your generated makefile we can find you are using your own resource script.
Dialogs_private.res: Dialogs_private.rc dialogResource.rc
DevC++ will generate a resource script(ProjectName_private.rc, in your case, is Dialogs_private.rc) and make a resource file(ProjectName_private.res) via that script. in your case, this generated Dialogs_private.rc file may like this:
/* THIS FILE WILL BE OVERWRITTEN BY DEV-C++ */
/* DO NOT EDIT! */
#include "dialogResource.rc"
As you can see, it just included your dialogResource.rc. DevC++ will try to compile it. if your resource script have some error, then it can not be compiled. Then you will see an error that tell you recipe for target 'Dialogs_Private.res' failed .
You should check your own resource script and have a look if there is any error in your script file. For example, are you missing some resource you are going to compile but you forget to place the resource file to the correct path? After all your own resource script compiled successfully, this error will be fixed.