User forums > Using Code::Blocks
Whenever I add a class I get "Undefined reference to WinMain"
oBFusCATed:
So you're trying to create a class without a name?
SuperBoi45:
Here's one with the name:
oBFusCATed:
Can't reproduce this problem on Linux.
Can someone with a windows try it?
I suppose you're clicking OK twice in the two dialogs that are shown after this one?
stahta01:
--- Quote from: SuperBoi45 on November 10, 2014, 08:30:09 pm ---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?
--- End quote ---
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
--- Code: ----------------- 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
--- End code ---
Build log for Win GUI c++ created project then added class Foo2
--- Code: ---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
--- End code ---
Tim S.
stahta01:
I suggest trying only one optimization code at a time. Note, it is likely unrelated to your problem; but, it is a bad idea to set all three of them in most cases only one of them works.
--- Code: ----O3 -O2 -O1
--- End code ---
Tim S.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version