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:
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:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world!" << endl;
return 0;
}
shared/debug.h
struct Test
{
Test();
int i;
};
shared/debug.cpp:
#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:
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:
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.
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.