How exactly would I do that?
Also I notice in the build log that it's not linking with my main.cpp. How would I add it?
Is the file main.cpp part of your project?
If not, add it.
If yes, try rebuilding the project and post the full rebuild log.
I could NOT duplicate the problem on my own Windows build of Git SVN 10030 (I do NOT think any of my patches would affect this issue).
Edit: Please include the Code::Blocks version information.
Build log for console c++ created project then added class Foo
-------------- Build: ReleaseWin32 in testwinmainclass (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Winit-self -Wmain -pedantic-errors -Wfatal-errors -Wall -fexceptions -O2 -Wmissing-include-dirs -Wno-unused-local-typedefs -Iinclude -c E:\Test\testwinmainclass\main.cpp -o obj\ReleaseWin32\main.o
mingw32-g++.exe -Winit-self -Wmain -pedantic-errors -Wfatal-errors -Wall -fexceptions -O2 -Wmissing-include-dirs -Wno-unused-local-typedefs -Iinclude -c E:\Test\testwinmainclass\src\Foo.cpp -o obj\ReleaseWin32\src\Foo.o
mingw32-g++.exe -o bin\ReleaseWin32\testwinmainclass.exe obj\ReleaseWin32\main.o obj\ReleaseWin32\src\Foo.o -s
Output file is bin\ReleaseWin32\testwinmainclass.exe with size 467.00 KB
Build log for Win GUI c++ created project then added class Foo2
mingw32-g++.exe -Wmain -pedantic-errors -pedantic -Wfatal-errors -Wall -std=c++11 -O2 -Wmissing-include-dirs -Wno-unused-local-typedefs -Iinclude -c E:\Test\guiframeaddnewclass\main.cpp -o obj\ReleaseWin32\main.o
mingw32-g++.exe -Wmain -pedantic-errors -pedantic -Wfatal-errors -Wall -std=c++11 -O2 -Wmissing-include-dirs -Wno-unused-local-typedefs -Iinclude -c E:\Test\guiframeaddnewclass\src\Foo2.cpp -o obj\ReleaseWin32\src\Foo2.o
mingw32-g++.exe -o bin\ReleaseWin32\guiframeaddnewclass.exe obj\ReleaseWin32\main.o obj\ReleaseWin32\src\Foo2.o -s -lgdi32 -luser32 -lkernel32 -lcomctl32 -mwindows
Output file is bin\ReleaseWin32\guiframeaddnewclass.exe with size 11.00 KB
Tim S.
Yop, here it is:
-------------- Build: Debug in tmp4 (compiler: GNU GCC Compiler)---------------
[ 33.3%] mingw32-g++.exe -Wall -fexceptions -g -Wno-unused-local-typedefs -I -c G:\tmp\tmp4\main.cpp -o obj\Debug\main.o
[ 66.7%] mingw32-g++.exe -Wall -fexceptions -g -Wno-unused-local-typedefs -I -c G:\\tmp\tmp4\test.cpp -o obj\Debug\test.o
[100.0%] mingw32-g++.exe -o bin\Debug\tmp4.exe obj\Debug\main.o obj\Debug\test.o
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libmingw32.a(main.o):main.c:(.text.startup+0xa7): undefined reference to `WinMain@16'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
Process terminated with status 0 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))
Build log saved as:
And yes it is the -I option.... don't know why it is there... and why saving helps, but someone has fixed it in trunk...
[Edit:] saving project is not enough , you have to re open it, so the parser checks for plausibility...