User forums > Using Code::Blocks

Trying to import a MingW/GCC project

(1/2) > >>

Viper187:
Running Win7, just installed the current version of Code::Blocks (mingw installer). I've been writing my source in Textpad and just compiling with mingw's msys environment for a while now since I got tired of Dev-C++. My problem is I have a project with a bunch of files that compiles fine with mingw, but I can't seem to get a Code::Blocks project started with all these files to actually compile. I tried adding them all and compiling, but after running mingw32-gcc.exe to build all the obj files, it tries to use mingw32-g++ and just stops. It shouldn't even need mingw32-g++ for this; mingw only used gcc.exe and windres.exe. The default compiler is set to GNU GCC Compiler. I tried setting it to use my original MakeFile, but it complained a that not having a "Debug target." It really shouldn't be this difficult to load up my existing project and make it compile.


--- Code: ---mingw32-gcc.exe -Wall  -g     -c H:\Private\gsctoolz2k\c\RenegadeEX2-CB\tab_settings.c -o obj\Debug\tab_settings.o
mingw32-g++.exe  -o "bin\Debug\Renegade EX2.exe" obj\Debug\lib_api.o obj\Debug\lib_api.o obj\Debug\lib_fileio.o obj\Debug\lib_listview.o obj\Debug\lib_memory.o obj\Debug\lib_misc.o obj\Debug\lib_rex.o obj\Debug\lib_search.o obj\Debug\rex.o obj\Debug\tab_hook.o obj\Debug\tab_results.o obj\Debug\tab_search.o obj\Debug\tab_settings.o  obj\Debug\rex.res   -lgdi32 -luser32 -lkernel32 -lcomctl32
Execution of 'mingw32-g++.exe  -o "bin\Debug\Renegade EX2.exe" obj\Debug\lib_api.o obj\Debug\lib_api.o obj\Debug\lib_fileio.o obj\Debug\lib_listview.o obj\Debug\lib_memory.o obj\Debug\lib_misc.o obj\Debug\lib_rex.o obj\Debug\lib_search.o obj\Debug\rex.o obj\Debug\tab_hook.o obj\Debug\tab_results.o obj\Debug\tab_search.o obj\Debug\tab_settings.o  obj\Debug\rex.res   -lgdi32 -luser32 -lkernel32 -lcomctl32' in 'H:\Private\gsctoolz2k\c\RenegadeEX2-CB\Renegade EX2' failed.
Nothing to be done (all items are up-to-date).

--- End code ---

My original makefile:

--- Code: ---# Project: RenegadeEx

NAME  = rex.exe

CC = gcc
WINDRES = windres
RES  = rex.res
OBJ  = rex.o tab_hook.o tab_results.o tab_search.o tab_settings.o lib_api.o lib_fileio.o lib_listview.o lib_misc.o lib_rex.o lib_search.o lib_memory.o $(RES)
LDFLAGS = -s -mwindows -lwsock32 -lcomctl32 -lpsapi
CFLAGS = -O2 -s


.PHONY: all

all: $(NAME)


clean:
rm -f $(OBJ)

$(NAME): $(OBJ)
$(CC) $(OBJ) -o $(NAME) $(LDFLAGS)

rex.res: rex.rc rex_gui.h
$(WINDRES) -i rex.rc -J rc -o rex.res -O coff

rex.o: rex.c rex.h rex_gui.h _types.h
$(CC) -c rex.c -o rex.o $(CFLAGS)

#Tabs

tab_hook.o: tab_hook.c rex.h rex_gui.h _types.h
$(CC) -c tab_hook.c -o tab_hook.o $(CFLAGS)

tab_results.o: tab_results.c rex.h rex_gui.h _types.h
$(CC) -c tab_results.c -o tab_results.o $(CFLAGS)

tab_search.o: tab_search.c rex.h rex_gui.h _types.h
$(CC) -c tab_search.c -o tab_search.o $(CFLAGS)

tab_settings.o: tab_settings.c rex.h rex_gui.h _types.h
$(CC) -c tab_settings.c -o tab_settings.o $(CFLAGS)

#Libraries

lib_api.o: lib_api.c rex.h _types.h
$(CC) -c lib_api.c -o lib_api.o $(CFLAGS)

lib_fileio.o: lib_fileio.c rex.h _types.h
$(CC) -c lib_fileio.c -o lib_fileio.o $(CFLAGS)

lib_listview.o: lib_listview.c rex.h _types.h
$(CC) -c lib_listview.c -o lib_listview.o $(CFLAGS)

lib_memory.o: lib_memory.c rex.h _types.h
$(CC) -c lib_memory.c -o lib_memory.o $(CFLAGS)

lib_misc.o: lib_misc.c lib_misc.h rex.h _types.h
$(CC) -c lib_misc.c -o lib_misc.o $(CFLAGS)

lib_rex.o: lib_rex.c rex.h _types.h
$(CC) -c lib_rex.c -o lib_rex.o $(CFLAGS)

lib_search.o: lib_search.c lib_search.h rex.h _types.h
$(CC) -c lib_search.c -o lib_search.o $(CFLAGS)

--- End code ---

stahta01:
Add the below lines to your make file is the fastest solution to get CB Debug target to build (using a custom makefile).
(You can also change Code::Blocks to match your makefile; but, I find it easier to change the makefile to match CB)


--- Code: ---Debug: $(NAME)

cleanDebug: clean

--- End code ---

The other solution is to compile hello world from the wizard to verify your compiler and CB and setup correctly.
After that try to find what is the problem when what you are trying to do.

Edit: Spaces in EXE filenames is NOT a wise thing to do!

Tim S.

oBFusCATed:

--- Quote from: stahta01 on March 21, 2013, 12:03:33 am ---(You can also change Code::Blocks to match your makefile; but, I find it easier to change the makefile to match CB)

--- End quote ---
In fact there is a hidden tab in the build options, where the user can modify the exact command executed for the different operations
and there is no need to modify the makefiles.

stahta01:

--- Quote from: oBFusCATed on March 21, 2013, 01:15:08 am ---
--- Quote from: stahta01 on March 21, 2013, 12:03:33 am ---(You can also change Code::Blocks to match your makefile; but, I find it easier to change the makefile to match CB)

--- End quote ---
In fact there is a hidden tab in the build options, where the user can modify the exact command executed for the different operations
and there is no need to modify the makefiles.

--- End quote ---

My makefile projects are ran on multiple computers; using different version of CB.
I know about your way; just find it much easier to do it my way.

Tim S.

oBFusCATed:
My way is to use projects, I'm just suggesting that there are options.
Most people aren't comfortable editing makefiles...

Navigation

[0] Message Index

[#] Next page

Go to full version