Code::Blocks Forums

User forums => Help => Topic started by: dave.berk on November 03, 2008, 08:34:16 am

Title: Creating portable CodeBlocks: linking MinGW
Post by: dave.berk on November 03, 2008, 08:34:16 am
Hi

I'm trying to create a portable version of codeblocks so I can use it in my uni. I have seen the FAQ but my problem is a little bit different. I have the MinGW directory inside the CodeBlocks folder and I want all links from inside CodeBlocks to MinGW to be location independent, so long as this structure is intact.

So what I did is use CodeBlocks builtin variables while setting the compiler toolchain location, like so: $(CODEBLOCKS)/MinGW

The problem I have is that:
1. Trying to compile anything, even the simplest hello world, I get errors
Code
||=== test, Debug ===|
\Project_Euler\test\main.c|1|stdio.h: No such file or directory|
\Project_Euler\test\main.c|2|stdlib.h: No such file or directory|
\Project_Euler\test\main.c||In function `main':|
\Project_Euler\test\main.c|6|warning: implicit declaration of function `printf'|
||=== Build finished: 2 errors, 1 warnings ===|
2. When trying to create a project, it doesn't let me use the builtin variables, so I can't create location independent projects folder

Thanks
Dave
Title: Re: Creating portable CodeBlocks: linking MinGW
Post by: thomas on November 03, 2008, 11:52:37 am
Quote
$(CODEBLOCKS)/MinGW
Should that not be $(CODEBLOCKS)/MinGW/include ?
Title: Re: Creating portable CodeBlocks: linking MinGW
Post by: TDragon on November 03, 2008, 03:56:57 pm
For the toolchain location, I think dave.berk has it right. Dave, what version of GCC are you using? Can you enable full command-line logging? Do the files [drive]:\[codeblocks]\MinGW\include\stdio.h and stdlib.h in fact exist? (In other words, you have installed the full mingw-runtime package?)
Title: Re: Creating portable CodeBlocks: linking MinGW
Post by: dave.berk on November 03, 2008, 08:45:42 pm
For the toolchain location, I think dave.berk has it right. Dave, what version of GCC are you using? Can you enable full command-line logging? Do the files [drive]:\[codeblocks]\MinGW\include\stdio.h and stdlib.h in fact exist? (In other words, you have installed the full mingw-runtime package?)

You're right. I thought I had installed the whole package but I doing a search I could only find the c++ header, i.e. cstdio, not the stdio.h header. The weird thing is I can't find the c standard library libs and header anywhere in MinGW sourceforge repository. Since it's course homework, I can't do it in c++ :(.

Edit: I'm using GCC 3.4.5..
Title: Re: Creating portable CodeBlocks: linking MinGW
Post by: TDragon on November 03, 2008, 09:54:03 pm
"stdio.h" is in the mingw-runtime dev package (the most recent release of which is mingwrt-3.15.1-mingw32-dev).
Title: Re: Creating portable CodeBlocks: linking MinGW
Post by: dave.berk on November 03, 2008, 10:24:46 pm
Thanks, TDragon!

About the second question: anybody knows why there's no variable expension when using new project wizards?

Edit: Got another problem:
Code
-------------- Build: Debug in test ---------------

Compiling: main.c
mingw32-gcc.exe: installation problem, cannot exec `as': No such file or directory
Process terminated with status 1 (0 minutes, 1 seconds)
0 errors, 0 warnings
How can I add to the PATH environment variable that CodeBlocks run (and remove it at the end)??
Title: Re: Creating portable CodeBlocks: linking MinGW
Post by: TDragon on November 03, 2008, 11:05:12 pm
You shouldn't need to make any PATH additions for the sake of MinGW/GCC, but you could always use a batch file. As far as the "cannot exec 'as'" error -- do you have the binutils binaries? Once unpacked, as.exe and friends should reside in both <mingw>/bin and <mingw>/mingw32/bin.
Title: Re: Creating portable CodeBlocks: linking MinGW
Post by: dave.berk on November 04, 2008, 05:11:42 pm
That did it. Thanks again. Download binutils and everything's working fine.

One question: Does anybody knows how to setup relative projects directory inside the new project wizard?