Author Topic: undefined reference to `WinMain@16'  (Read 8621 times)

Offline wever

  • Multiple posting newcomer
  • *
  • Posts: 49
undefined reference to `WinMain@16'
« on: August 30, 2014, 11:49:26 pm »
I got this error:

Code
mingw32-g++.exe -LC:\PROGRA~1\AMDAPP~1\lib\x86\ -o bin\Debug\Gaussian_with_OpenCL.exe obj\Debug\args.o obj\Debug\bitmap.o obj\Debug\gaussian.o   C:\PROGRA~1\AMDAPP~1\lib\x86\OpenCL.lib W:\___NEW~1\GAUSSI~1\GAUSSI~2\refu.dll C:\PROGRA~1\AMDAPP~1\lib\x86\OpenCL.lib W:\___NEW~1\GAUSSI~1\GAUSSI~2\refu.dll
p:/programy/programování/codeblocks_32bit/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../libmingw32.a(main.o):main.c:(.text.startup+0xa7): undefined reference to `WinMain@16'
collect2.exe: error: ld returned 1 exit status


I am using gcc and main function. On stackoverflow somebody suggested to use -mwindows option but 1) I did not find what does this do 2) I cannot find out where should I place this option or how you configure the options for compiler in code blocks. Help pls

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: undefined reference to `WinMain@16'
« Reply #1 on: August 31, 2014, 12:25:16 am »
Project -> properties -> build targets -> Type set it to native or gui...
If it doesn't work (I'm not a windows user anymore) search the forum for sollutions...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline wever

  • Multiple posting newcomer
  • *
  • Posts: 49
Re: undefined reference to `WinMain@16'
« Reply #2 on: August 31, 2014, 09:52:37 am »
I made it working. It was because there was not created main script, so the main function was missing.