User forums > Using Code::Blocks

Whenever I add a class I get "Undefined reference to WinMain"

(1/5) > >>

SuperBoi45:
Let's say I am writing a C++ program and I want to add a new class.

I would have to go to File->New->Class... and then I select the class. I select "Create" and then the files appear. Everything was working before but now when I build and run I get

c:\mingw\bin\..\lib\gcc\mingw32\4.8.1\..\..\..\libmingw32.a(main.o):main.c:(.text.startup+0xa7)||undefined reference to `WinMain@16'|

Here is the build log:


-------------- Build: Debug in Hybrid (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -fexceptions -g -O3 -O2 -O1 -Wshadow -Winit-self -Wredundant-decls -Wfloat-equal -Wunreachable-code -Wmain -pedantic-errors -pedantic -std=c++11 -Wfatal-errors -Wall -I -c "C:\Documents and Settings\David Godfrey\Desktop\Projects\Hybrid\Foo.cpp" -o obj\Debug\Foo.o

The only class I added was Foo. Does anyone know why this is happening?

oBFusCATed:
Yes, there is a bug that adds an empty include path in the settings.
You probably have to remove the empty path from the build options.

SuperBoi45:
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?

oBFusCATed:
Can you post a screenshot with the class wizard dialog, just before you press the Ok button?

SuperBoi45:

Navigation

[0] Message Index

[#] Next page

Go to full version