Author Topic: [Solved] problems using c::b with mingw  (Read 4368 times)

Offline Lastmerlin

  • Single posting newcomer
  • *
  • Posts: 3
[Solved] problems using c::b with mingw
« on: April 26, 2008, 10:11:56 pm »
I am trying to get a (so far linux only) project working on Windows Vista using Code::Blocks with MinGW.

The project consists of two separate programs, a server and a client. The structure is: Each part has its own source files (of course) but there are also some source files which are used both in the client and the server part (mainly some common data structures and some basic network stuff).
When trying to compile within C::B I get following error:

Quote
Compiling: main.cpp
mingw32-g++.exe: 5: No such file or directory

I have reduced the program to three files:
main.cpp
shared/debug.h
shared/debug.cpp

These files are also reduced to few lines, so i just quote them:

main.cpp:
Quote
#include <iostream>

using namespace std;

int main()
{
    cout << "Hello world!" << endl;
    return 0;
}


shared/debug.h
Quote
struct Test
{
  Test();

  int i;
};

shared/debug.cpp:
Quote
#include "debug.h"

Test::Test()
{
    i=0;
}

This is a minimal setup to reproduce the error.
If I remove the debug.* file then everything works fine.
I can also compile the whole thing in cmd:
Quote
C:\Users\hans\tests\cbtest>g++ -c -o main.o main.cpp

C:\Users\hans\tests\cbtest>g++ -c -o shared\debug.o shared\debug.cpp

C:\Users\hans\tests\cbtest>g++ -o hello main.o shared\debug.o

C:\Users\hans\tests\cbtest>hello
Hello world!

The first error message does not say that there is a problem with compiling main.cpp - main.cpp is compiled correctly and main.o is present after pressing >built< . But after compiling main.cpp it seems that c::b cant find the compiler any more. If I press built a second time i get:

Quote
Compiling: shared\debug.cpp
mingw32-g++.exe: 5: No such file or directory

So shared\debug.o is created but the next call of g++ (for linking) fails. After pressing built a third time i have my hello world program complete.

Quote
Linking console executable: bin\Debug\cbtest.exe
Output size is 584.46 KB

So always exactly _one_ source file is compiled and the next compiler call causes the error. This behavior is not nice, if your project gets a bit more than two .cpp files...

I have already extended the $path variable, this seems a common problem with mingw and vista. This didnt solve it :(

Thanks for any suggestions.
« Last Edit: April 27, 2008, 07:13:01 pm by Lastmerlin »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: problems using c::b with mingw
« Reply #1 on: April 27, 2008, 09:04:40 am »
Please provide a zipped project (including the files you describe here *and* the C::B project file). Most likely this is a wrong project / target setup.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Lastmerlin

  • Single posting newcomer
  • *
  • Posts: 3
Re: problems using c::b with mingw
« Reply #2 on: April 27, 2008, 12:55:37 pm »
la voila :)

I hope that this project shows the problem.

[attachment deleted by admin]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: problems using c::b with mingw
« Reply #3 on: April 27, 2008, 01:20:41 pm »
In the "Build Options" of your project you have to put an equal sign between "DEBUG_LEVEL" and  "5":
Code
DEBUG_LEVEL=5

Offline Lastmerlin

  • Single posting newcomer
  • *
  • Posts: 3
Re: problems using c::b with mingw
« Reply #4 on: April 27, 2008, 07:12:35 pm »
ah, this does it. Thank you very much.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: problems using c::b with mingw
« Reply #5 on: April 27, 2008, 08:07:54 pm »
ah, this does it. Thank you very much.
Well... erm... nor more to say. Seems I was too late for offering a solution. ;-) Thanks Jens! :P
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ