No, I'm definitely not putting #include"protocol.gch" in my .cpp files. Here's my compile log (after running a dist-clean):
Project : Console application
Compiler : GNU GCC Compiler (called directly)
Directory : D:\Projects\GeccoTester\
--------------------------------------------------------------------------------
Switching to target: default
mingw32-g++.exe -g -ID:\Projects\GeccoTester\ -I..\ptypes-2.0.2\include -I"d:\Program Files\CodeBlocks\include" -ID:\Projects\ptypes-2.0.2\include -c protocol.cpp -o .objs\protocol.o
mingw32-gcc.exe -g -ID:\Projects\GeccoTester\ -I..\ptypes-2.0.2\include -I"d:\Program Files\CodeBlocks\include" -ID:\Projects\ptypes-2.0.2\include -c sha256.c -o .objs\sha256.o
mingw32-g++.exe -g -ID:\Projects\GeccoTester\ -I..\ptypes-2.0.2\include -I"d:\Program Files\CodeBlocks\include" -ID:\Projects\ptypes-2.0.2\include -c main.cpp -o .objs\main.o
mingw32-g++.exe -LD:\Projects\GeccoTester\ -L..\ptypes-2.0.2\lib -L"d:\Program Files\CodeBlocks\lib" -LD:\Projects\ptypes-2.0.2\lib -o D:\Projects\GeccoTester\GeccoTester.exe .objs\protocol.o protocol.h.gch .objs\sha256.o sha256.h.gch .objs\main.o ..\ptypes-2.0.2\lib\libptypes.a
mingw32-g++.exe: protocol.h.gch: No such file or directory
mingw32-g++.exe: sha256.h.gch: No such file or directory
Process terminated with status 1 (0 minutes, 11 seconds)
0 errors, 0 warnings
It seems to be be looking for the *.h.gch files specifically. I think this is coming from here:
(http://img208.imageshack.us/img208/821/bad1xs.png)
OK, that reduced it to some errors that I'm more familiar with...
Project : Console application
Compiler : GNU GCC Compiler (called directly)
Directory : D:\Projects\GeccoTester\
--------------------------------------------------------------------------------
Switching to target: default
mingw32-g++.exe -LD:\Projects\GeccoTester\ -L..\ptypes-2.0.2\lib -L"d:\Program Files\CodeBlocks\lib" -LD:\Projects\ptypes-2.0.2\lib -o D:\Projects\GeccoTester\GeccoTester.exe .objs\protocol.o .objs\sha256.o .objs\main.o ..\ptypes-2.0.2\lib\libptypes.a
.objs\protocol.o: In function `ZN21AccountRequestMessage6assignEPKcj':
D:/Projects/GeccoTester/protocol.cpp:58: undefined reference to `sha256_starts(sha256_context*)'
D:/Projects/GeccoTester/protocol.cpp:59: undefined reference to `sha256_update(sha256_context*, unsigned char*, unsigned long)'
D:/Projects/GeccoTester/protocol.cpp:60: undefined reference to `sha256_finish(sha256_context*, unsigned char*)'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 2 seconds)
3 errors, 0 warnings
However, I don't understand why I'm getting linker errors here since I've properly included " #include"protocol.h" as well as put the current project directory in the linker path. Any ideas?
[...]
mingw32-g++.exe -LD:\Projects\GeccoTester\ -L..\ptypes-2.0.2\lib -L"d:\Program Files\CodeBlocks\lib" -LD:\Projects\ptypes-2.0.2\lib -o D:\Projects\GeccoTester\GeccoTester.exe .objs\protocol.o .objs\sha256.o .objs\main.o ..\ptypes-2.0.2\lib\libptypes.a
.objs\protocol.o: In function `ZN21AccountRequestMessage6assignEPKcj':
D:/Projects/GeccoTester/protocol.cpp:58: undefined reference to `sha256_starts(sha256_context*)'
D:/Projects/GeccoTester/protocol.cpp:59: undefined reference to `sha256_update(sha256_context*, unsigned char*, unsigned long)'
D:/Projects/GeccoTester/protocol.cpp:60: undefined reference to `sha256_finish(sha256_context*, unsigned char*)'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 2 seconds)
3 errors, 0 warnings
Those errors basically mean "AccountRequestMessage::assign(char const*, unsigned int) is using three functions that have been declared but aren't defined in any (linked) object file".
Judging by their names, I'd assume they were supposed to be in sha256.cpp. See if they are defined there, and if their signature is exactly the same (incuding constness etc.).
Another possibility that just occurred to me: these look like C functions (sha256_ prefix, char*'s). If they're actually defined in a .c file, that might also explain it: C++ uses a different naming scheme than C by default. The fix would be to either rename the file to have an extension associated with C++ (.cpp is the most popular AFAIK), specify '-x c++' as an additional command-line option for these files, or change the header associated with it to be similar to this:
#ifndef SOME_HEADER_GUARD
#define SOME_HEADER_GUARD
#ifdef __cplusplus
extern "C" {
#endif
/* * * The rest of the original header * * */
#ifdef __cplusplus
} // extern "C"
#endif
#endif // SOME_HEADER_GUARD
(you can also put extern "C" in front of each and every declaration your C++ program uses, but that's probably more work)