User forums > Help

[Solved] problems using c::b with mingw

(1/2) > >>

Lastmerlin:
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

--- End quote ---

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;
}

--- End quote ---


shared/debug.h

--- Quote ---struct Test
{
  Test();

  int i;
};

--- End quote ---

shared/debug.cpp:

--- Quote ---#include "debug.h"

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

--- End quote ---

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!

--- End quote ---

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

--- End quote ---

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

--- End quote ---

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.

MortenMacFly:
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.

Lastmerlin:
la voila :)

I hope that this project shows the problem.

[attachment deleted by admin]

Jenna:
In the "Build Options" of your project you have to put an equal sign between "DEBUG_LEVEL" and  "5":

--- Code: ---DEBUG_LEVEL=5

--- End code ---

Lastmerlin:
ah, this does it. Thank you very much.

Navigation

[0] Message Index

[#] Next page

Go to full version