Author Topic: won't compile, even defualt console.  (Read 5032 times)

avgprogramerjoe

  • Guest
won't compile, even defualt console.
« on: September 04, 2007, 02:10:32 am »
Hey guys i was working on a game, and I don't think i did anything but my code just wouldn't compile, so i spent all day trying to figure out, untill i reverted to previus code in which had run before, yet did not run then. So i tried the defualt sdl app, which did not run, and the default console which did not run. So i reinstalled codeblocks and it is still not working. I get this message.
Quote
Project   : Console application
Compiler  : GNU GCC Compiler (called directly)
Directory : C:\Documents and Settings\Owner.YOUR-99DDF15D27\My Documents\myprograms\
--------------------------------------------------------------------------------
Switching to target: default
Linking console executable: C:\Documents and Settings\Owner.YOUR-99DDF15D27\My Documents\myprograms\console.exe
C:\Program Files\CodeBlocks\lib/libmingw32.a(main.o):main.c:(.text+0x106): undefined reference to `WinMain@16'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)

I'm using windows xp, 32bt with mingw which i installed with code::blocks, could i have vc++ 05 installed as well and did have devc++. I don't know if any of that matters, and if you need any other info please let me know.

I hope i was informative enough, as I learned from the post, posted earlier with the same problem, except on linux.

Joe

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: won't compile, even defualt console.
« Reply #1 on: September 04, 2007, 07:49:18 am »
Linking console executable: C:\Documents and Settings\Owner.YOUR-99DDF15D27\My Documents\myprograms\console.exe
C:\Program Files\CodeBlocks\lib/libmingw32.a(main.o):main.c:(.text+0x106): undefined reference to `WinMain@16'
collect2: ld returned 1 exit status
Please enable full command line (see my sig) and re-post the ouput of C::B.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: won't compile, even defualt console.
« Reply #2 on: September 04, 2007, 10:09:36 am »
Linking console executable [...] undefined reference to `WinMain@16'
Change your target's type to GUI executable (project options).
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

avgprogramerjoe

  • Guest
Re: won't compile, even defualt console.
« Reply #3 on: September 04, 2007, 01:45:38 pm »
I followed your sig, and I think you wanted the info under the code::blocks debug tab, if so here it is after i enabled full command line logging.

Quote
Loading lexer_cg.xml
Loading lexer_cpp.xml
Loading lexer_f77.xml
Loading lexer_gm.xml
Loading lexer_hitasm.xml
Loading lexer_lua.xml
Loading lexer_prg.xml
Loading lexer_rc.xml
Loading lexer_xml.xml
Loading toolbar...
Added compiler "GNU GCC Compiler"
Added compiler "Microsoft Visual C++ Toolkit 2003"
Added compiler "Borland C++ Compiler 5.5"
Added compiler "Digital Mars Compiler"
Added compiler "OpenWatcom (W32) Compiler"
Added compiler "SDCC Compiler"
Source code formatter (AStyle) plugin loaded
C::B Profiler plugin loaded
Class wizard plugin loaded
Code completion plugin loaded
Code Statistics plugin loaded
Compiler plugin loaded
GDB Debugger plugin loaded
Default MIME handler plugin loaded
Dev-C++ DevPak updater/installer plugin loaded
Source HTML, RTF and ODT exporter plugin loaded
Help plugin plugin loaded
Code::Blocks Plugin wizard plugin loaded
To-Do List plugin loaded
Windows XP Look'n'Feel plugin loaded
Loading workspace "C:\Documents and Settings\Owner.YOUR-99DDF15D27\.CodeBlocks\default.workspace"
Loading project file...
Parsing project file...
Loading target default
Loading project files...
Project's base path: C:\Documents and Settings\Owner.YOUR-99DDF15D27\My Documents\myprograms\
Project's common toplevel path: C:\Documents and Settings\Owner.YOUR-99DDF15D27\My Documents\myprograms\
Start parsing project Console application
Concurrent threads for pool set to 2
End parsing project Console application (no files found?)
Setting up compiler environment...
Setting up compiler environment...
Loading project file...
Parsing project file...
Loading target default
Loading project files...
Project's base path: C:\Documents and Settings\Owner.YOUR-99DDF15D27\My Documents\myprograms\
Project's common toplevel path: C:\Documents and Settings\Owner.YOUR-99DDF15D27\My Documents\myprograms\
Start parsing project SDL Application
Concurrent threads for pool set to 2
Setting up compiler environment...
Done parsing project SDL Application (1 total parsed files, 67 tokens in 0.47 seconds).
Updating class browser...
Class browser updated.
project data set for C:\Documents and Settings\Owner.YOUR-99DDF15D27\My Documents\myprograms\game.cpp
Top Editor: C:\Documents and Settings\Owner.YOUR-99DDF15D27\My Documents\myprograms\game.cpp
Loading project file...
Parsing project file...
Loading target default
Loading project files...
Project's base path: C:\Documents and Settings\Owner.YOUR-99DDF15D27\My Documents\myprograms\
Project's common toplevel path: C:\Documents and Settings\Owner.YOUR-99DDF15D27\My Documents\myprograms\
Start parsing project SDL Application
Concurrent threads for pool set to 2
Setting up compiler environment...
Done parsing project SDL Application (1 total parsed files, 1 tokens in 0.47 seconds).
Updating class browser...
Class browser updated.
project data set for C:\Documents and Settings\Owner.YOUR-99DDF15D27\My Documents\myprograms\main.cpp
Setting up compiler environment...
Parser::TerminateAllThreads: Aborting all tasks...
C++ Parser freed
Setting up compiler environment...
Setting up compiler environment...
Parser::TerminateAllThreads: Aborting all tasks...
C++ Parser freed
Setting up compiler environment...
Setting up compiler environment...
Parser::TerminateAllThreads: Aborting all tasks...
C++ Parser freed
12 templates loaded
0 user templates loaded
Loading project file...
Parsing project file...
Loading target default
Loading project files...
Project's base path: C:\Documents and Settings\Owner.YOUR-99DDF15D27\My Documents\myprograms\
Project's common toplevel path: C:\Documents and Settings\Owner.YOUR-99DDF15D27\My Documents\myprograms\
Start parsing project SDL Application
Concurrent threads for pool set to 2
End parsing project SDL Application (no files found?)
Setting up compiler environment...
found C:\Documents and Settings\Owner.YOUR-99DDF15D27\My Documents\myprograms\main.cpp
Scanned 0 files for #includes, cache used 1, cache updated 0
Setting up compiler environment...
Setting up compiler environment...
Scanned 0 files for #includes, cache used 1, cache updated 0
Setting up compiler environment...
Setting up compiler environment...
Scanned 0 files for #includes, cache used 1, cache updated 0
Setting up compiler environment...
Scanned 0 files for #includes, cache used 1, cache updated 0
Setting up compiler environment...
Setting up compiler environment...
Scanned 0 files for #includes, cache used 1, cache updated 0
Setting up compiler environment...
Scanned 0 files for #includes, cache used 1, cache updated 0
Scanned 0 files for #includes, cache used 1, cache updated 0
Scanned 0 files for #includes, cache used 1, cache updated 0
Scanned 0 files for #includes, cache used 1, cache updated 0
Setting up compiler environment...
Scanned 0 files for #includes, cache used 1, cache updated 0
Scanned 0 files for #includes, cache used 1, cache updated 0
Setting up compiler environment...
12 templates loaded
0 user templates loaded
Loading project file...
Parsing project file...
Loading target default
Loading project files...
Project's base path: C:\Documents and Settings\Owner.YOUR-99DDF15D27\My Documents\myprograms\
Project's common toplevel path: C:\Documents and Settings\Owner.YOUR-99DDF15D27\My Documents\myprograms\
Start parsing project Console application
Concurrent threads for pool set to 2
End parsing project Console application (no files found?)
Setting up compiler environment...
Could not find Insert menu!
found C:\Documents and Settings\Owner.YOUR-99DDF15D27\My Documents\myprograms\main.cpp
Scanned 0 files for #includes, cache used 1, cache updated 0
Setting up compiler environment...
Setting up compiler environment...
Scanned 0 files for #includes, cache used 1, cache updated 0
Setting up compiler environment...
Setting up compiler environment...
Scanned 0 files for #includes, cache used 1, cache updated 0
Setting up compiler environment...
Setting up compiler environment...

Is there any other way I can help?


Joe

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: won't compile, even defualt console.
« Reply #4 on: September 05, 2007, 02:20:32 pm »
I followed your sig, and I think you wanted the info under the code::blocks debug tab, if so here it is after i enabled full command line logging.
Oh dear... :lol:
I didn't mean the startup-log but the compiler log that has more information afterwards when you are *compiling* the application. Anyway - did you already try the hint Thomas gave you?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

avgprogramerjoe

  • Guest
Re: won't compile, even defualt console.
« Reply #5 on: September 12, 2007, 11:07:10 pm »
Yes i followed his advice, and i tried the defualt console application with the target being console application, etc.
It comes down to the fact that I can't get
Code
#include <iostream>

int main()
{
std::cout << "Hello world!" << std::endl;
return 0;
}
to work. I can't get anything to work, it's not just the gui applications.
For the hello world build log I got:
Quote
Switching to target: default
mingw32-g++.exe    -L"C:\Program Files\CodeBlocks\lib" -o "C:\Documents and Settings\Owner.YOUR-99DDF15D27\My Documents\myprograms\console.exe" .objs\main.o         -lSDL -lSDL_image -lSDLmain
C:\Program Files\CodeBlocks\lib/libmingw32.a(main.o):main.c:(.text+0x106): undefined reference to `WinMain@16'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 1 seconds)
 
I have, however noticed that it compiles fine when I click compile, but if I click build I get the message above.

Any help will be greatly appreciated,

Joe

P.S. sorry it took me so long, I got restricted from the computer for a bit....

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: won't compile, even defualt console.
« Reply #6 on: September 13, 2007, 07:50:54 am »
-lSDL -lSDL_image -lSDLmain
Remove those libraries from the linker settings of your project and it will certainly work.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ