Author Topic: Creating portable CodeBlocks: linking MinGW  (Read 8750 times)

Offline dave.berk

  • Single posting newcomer
  • *
  • Posts: 8
Creating portable CodeBlocks: linking MinGW
« 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

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Creating portable CodeBlocks: linking MinGW
« Reply #1 on: November 03, 2008, 11:52:37 am »
Quote
$(CODEBLOCKS)/MinGW
Should that not be $(CODEBLOCKS)/MinGW/include ?
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Creating portable CodeBlocks: linking MinGW
« Reply #2 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?)
« Last Edit: November 03, 2008, 03:59:22 pm by TDragon »
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline dave.berk

  • Single posting newcomer
  • *
  • Posts: 8
Re: Creating portable CodeBlocks: linking MinGW
« Reply #3 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..

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Creating portable CodeBlocks: linking MinGW
« Reply #4 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).
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline dave.berk

  • Single posting newcomer
  • *
  • Posts: 8
Re: Creating portable CodeBlocks: linking MinGW
« Reply #5 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)??
« Last Edit: November 03, 2008, 10:41:41 pm by dave.berk »

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Creating portable CodeBlocks: linking MinGW
« Reply #6 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.
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline dave.berk

  • Single posting newcomer
  • *
  • Posts: 8
Re: Creating portable CodeBlocks: linking MinGW
« Reply #7 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?