Codelite - all vers v6.x cause compile problem with SDL2 x86

Discussion about CodeLite development process and patches
metamorphosis
CodeLite Enthusiast
Posts: 45
Joined: Tue Jan 28, 2014 3:03 pm
Genuine User: Yes
IDE Question: C++
Contact:

Codelite - all vers v6.x cause compile problem with SDL2 x86

Post by metamorphosis »

The error is "undefined reference to SDL_main", however if codelite v6.x is removed and v5.4 is installed (also with mingw4.8.1 TDM package) the error is resolved.
The error occurs regardless of whether SDL v2.02 or v2.03 is used.
Cheers-
Matt
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Codelite - all vers v6.x cause compile problem with SDL2

Post by eranif »

Showing the build output will show the problem.
Seem my signature for how to post

Its not a codelite problem, as codelite is not a linker nor a compiler. You probably missing something in the settings, but I can't tell what unless I see the build log

Eran
Make sure you have read the HOW TO POST thread
petah
CodeLite Expert
Posts: 231
Joined: Sat Nov 24, 2012 8:04 pm
Genuine User: Yes
IDE Question: c++
Location: Los Angeles
Contact:

Re: Codelite - all vers v6.x cause compile problem with SDL2

Post by petah »

metamorphosis wrote:The error is "undefined reference to SDL_main", however if codelite v6.x is removed and v5.4 is installed (also with mingw4.8.1 TDM package) the error is resolved.
The error occurs regardless of whether SDL v2.02 or v2.03 is used.
Cheers-
Matt
Check the SDL dev mail list around August 24, 2014, the post "Migration paragraph about SDL_main is confusing - rewording suggestion". Whether that functions exists or is linkable depends on your platform and build settings (which you don't mention).

cheers,

-- p
main: Debian Jessie x64 + custom wxTrunk
metamorphosis
CodeLite Enthusiast
Posts: 45
Joined: Tue Jan 28, 2014 3:03 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Codelite - all vers v6.x cause compile problem with SDL2

Post by metamorphosis »

petah wrote: Check the SDL dev mail list around August 24, 2014, the post "Migration paragraph about SDL_main is confusing - rewording suggestion". Whether that functions exists or is linkable depends on your platform and build settings (which you don't mention).

-- p
Not actually relevant.
metamorphosis
CodeLite Enthusiast
Posts: 45
Joined: Tue Jan 28, 2014 3:03 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Codelite - all vers v6.x cause compile problem with SDL2

Post by metamorphosis »

eranif wrote:Showing the build output will show the problem.
Seem my signature for how to post

Its not a codelite problem, as codelite is not a linker nor a compiler. You probably missing something in the settings, but I can't tell what unless I see the build log

Eran
It's a codelite problem-
the same project with nothing changed works perfectly in codelite v5.4 with the same mingw 3.81 tdm setup. I can uninstall/reinstall 5.4 or 6.x ad-infinitum and it makes no difference - works on 5.4, doesn't on 6.x.
There may be something related to the way codelite processes builds in 6.x that is different from 5.4, which could be what's causing the error. Either that or there's a subtle difference between the mingw 3.81 tdm installed with 5.4 to the one installed by 6.x.

Not self-compiled.
XP sp3.
Build output from 6.1.1 is:

Code: Select all

"C:\WINDOWS\system32\cmd.exe /c "f:/programming/mingw/bin/mingw32-make.exe -j2 SHELL=cmd.exe  -e -f  Makefile"
"----------Building project:[ justatest - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'E:/programming/platforma'
f:/programming/mingw/bin/g++.exe   -c  "E:/programming/plflibrary/plf_log.cpp" -g -O0 -Wall   -o ./Debug/plflibrary_plf_log.cpp.o -I. -Ie:/programming/platforma -Ie:/programming/SDL_mixer/include/SDL2 -Ie:/programming/SDL_image/include/SDL2 -Ie:/programming/SDL/include/SDL2 -Ie:/programming/mingw/include
f:/programming/mingw/bin/g++.exe   -c  "E:/programming/plflibrary/plf_window.cpp" -g -O0 -Wall   -o ./Debug/plflibrary_plf_window.cpp.o -I. -Ie:/programming/platforma -Ie:/programming/SDL_mixer/include/SDL2 -Ie:/programming/SDL_image/include/SDL2 -Ie:/programming/SDL/include/SDL2 -Ie:/programming/mingw/include
f:/programming/mingw/bin/g++.exe   -c  "E:/programming/plflibrary/plf_renderer.cpp" -g -O0 -Wall   -o ./Debug/plflibrary_plf_renderer.cpp.o -I. -Ie:/programming/platforma -Ie:/programming/SDL_mixer/include/SDL2 -Ie:/programming/SDL_image/include/SDL2 -Ie:/programming/SDL/include/SDL2 -Ie:/programming/mingw/include
f:/programming/mingw/bin/g++.exe   -c  "E:/programming/plflibrary/plf_sprite.cpp" -g -O0 -Wall   -o ./Debug/plflibrary_plf_sprite.cpp.o -I. -Ie:/programming/platforma -Ie:/programming/SDL_mixer/include/SDL2 -Ie:/programming/SDL_image/include/SDL2 -Ie:/programming/SDL/include/SDL2 -Ie:/programming/mingw/include
f:/programming/mingw/bin/g++.exe   -c  "E:/programming/plflibrary/plf_texture.cpp" -g -O0 -Wall   -o ./Debug/plflibrary_plf_texture.cpp.o -I. -Ie:/programming/platforma -Ie:/programming/SDL_mixer/include/SDL2 -Ie:/programming/SDL_image/include/SDL2 -Ie:/programming/SDL/include/SDL2 -Ie:/programming/mingw/include
f:/programming/mingw/bin/g++.exe   -c  "E:/programming/plflibrary/plf_atlas.cpp" -g -O0 -Wall   -o ./Debug/plflibrary_plf_atlas.cpp.o -I. -Ie:/programming/platforma -Ie:/programming/SDL_mixer/include/SDL2 -Ie:/programming/SDL_image/include/SDL2 -Ie:/programming/SDL/include/SDL2 -Ie:/programming/mingw/include
f:/programming/mingw/bin/g++.exe   -c  "E:/programming/plflibrary/plf_math.cpp" -g -O0 -Wall   -o ./Debug/plflibrary_plf_math.cpp.o -I. -Ie:/programming/platforma -Ie:/programming/SDL_mixer/include/SDL2 -Ie:/programming/SDL_image/include/SDL2 -Ie:/programming/SDL/include/SDL2 -Ie:/programming/mingw/include
f:/programming/mingw/bin/g++.exe   -c  "E:/programming/plflibrary/plf_layer.cpp" -g -O0 -Wall   -o ./Debug/plflibrary_plf_layer.cpp.o -I. -Ie:/programming/platforma -Ie:/programming/SDL_mixer/include/SDL2 -Ie:/programming/SDL_image/include/SDL2 -Ie:/programming/SDL/include/SDL2 -Ie:/programming/mingw/include
f:/programming/mingw/bin/g++.exe   -c  "E:/programming/plflibrary/plf_engine.cpp" -g -O0 -Wall   -o ./Debug/plflibrary_plf_engine.cpp.o -I. -Ie:/programming/platforma -Ie:/programming/SDL_mixer/include/SDL2 -Ie:/programming/SDL_image/include/SDL2 -Ie:/programming/SDL/include/SDL2 -Ie:/programming/mingw/include
f:/programming/mingw/bin/g++.exe   -c  "E:/programming/plflibrary/plf_utility.cpp" -g -O0 -Wall   -o ./Debug/plflibrary_plf_utility.cpp.o -I. -Ie:/programming/platforma -Ie:/programming/SDL_mixer/include/SDL2 -Ie:/programming/SDL_image/include/SDL2 -Ie:/programming/SDL/include/SDL2 -Ie:/programming/mingw/include
f:/programming/mingw/bin/g++.exe   -c  "E:/programming/plflibrary/plf_sound.cpp" -g -O0 -Wall   -o ./Debug/plflibrary_plf_sound.cpp.o -I. -Ie:/programming/platforma -Ie:/programming/SDL_mixer/include/SDL2 -Ie:/programming/SDL_image/include/SDL2 -Ie:/programming/SDL/include/SDL2 -Ie:/programming/mingw/include
f:/programming/mingw/bin/g++.exe   -c  "E:/programming/plflibrary/plf_movement.cpp" -g -O0 -Wall   -o ./Debug/plflibrary_plf_movement.cpp.o -I. -Ie:/programming/platforma -Ie:/programming/SDL_mixer/include/SDL2 -Ie:/programming/SDL_image/include/SDL2 -Ie:/programming/SDL/include/SDL2 -Ie:/programming/mingw/include
f:/programming/mingw/bin/g++.exe   -c  "E:/programming/plflibrary/plf_music.cpp" -g -O0 -Wall   -o ./Debug/plflibrary_plf_music.cpp.o -I. -Ie:/programming/platforma -Ie:/programming/SDL_mixer/include/SDL2 -Ie:/programming/SDL_image/include/SDL2 -Ie:/programming/SDL/include/SDL2 -Ie:/programming/mingw/include
f:/programming/mingw/bin/g++.exe   -c  "E:/programming/plflibrary/plf_level.cpp" -g -O0 -Wall   -o ./Debug/plflibrary_plf_level.cpp.o -I. -Ie:/programming/platforma -Ie:/programming/SDL_mixer/include/SDL2 -Ie:/programming/SDL_image/include/SDL2 -Ie:/programming/SDL/include/SDL2 -Ie:/programming/mingw/include
f:/programming/mingw/bin/g++.exe   -c  "E:/programming/plflibrary/plf_physics.cpp" -g -O0 -Wall   -o ./Debug/plflibrary_plf_physics.cpp.o -I. -Ie:/programming/platforma -Ie:/programming/SDL_mixer/include/SDL2 -Ie:/programming/SDL_image/include/SDL2 -Ie:/programming/SDL/include/SDL2 -Ie:/programming/mingw/include
f:/programming/mingw/bin/g++.exe   -c  "E:/programming/plflibrary/plf_entity.cpp" -g -O0 -Wall   -o ./Debug/plflibrary_plf_entity.cpp.o -I. -Ie:/programming/platforma -Ie:/programming/SDL_mixer/include/SDL2 -Ie:/programming/SDL_image/include/SDL2 -Ie:/programming/SDL/include/SDL2 -Ie:/programming/mingw/include
f:/programming/mingw/bin/g++.exe   -c  "E:/programming/platforma/plf_spacialhash.cpp" -g -O0 -Wall   -o ./Debug/plf_spacialhash.cpp.o -I. -Ie:/programming/platforma -Ie:/programming/SDL_mixer/include/SDL2 -Ie:/programming/SDL_image/include/SDL2 -Ie:/programming/SDL/include/SDL2 -Ie:/programming/mingw/include
f:/programming/mingw/bin/g++.exe  -o ./Debug/justatest @"justatest.txt" -L. -Le:/programming/SDL_mixer/lib -Le:/programming/SDL_image/lib -Le:/programming/SDL/lib -Le:/programming/mingw/lib   -lmingw32 -lSDL2_mixer -lSDL2_image -lSDL2main -lSDL2
e:/programming/SDL/lib/libSDL2main.a(SDL_windows_main.o): In function `console_main':
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/main/windows/SDL_windows_main.c:140: undefined reference to `SDL_main'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[1]: *** [Debug/justatest] Error 1
mingw32-make.exe: *** [All] Error 2
justatest.mk:80: recipe for target 'Debug/justatest' failed
mingw32-make.exe[1]: Leaving directory 'E:/programming/platforma'
Makefile:4: recipe for target 'All' failed
2 errors, 0 warnings
Gibbon1
CodeLite Expert
Posts: 167
Joined: Fri Jul 22, 2011 5:32 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Codelite - all vers v6.x cause compile problem with SDL2

Post by Gibbon1 »

Odd thought, try changing the optimization level from -O0 to -O2
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Codelite - all vers v6.x cause compile problem with SDL2

Post by eranif »

I can't see how this is a codelite problem.
Even though you say nothing has changed, you just replaced 6.0 with 5.4, something did change...
Can you provide a minimal sample that reproduces the problem?

Quick googling shows this:

https://wiki.libsdl.org/FAQWindows#I_ge ... .27.22_...
http://stackoverflow.com/questions/4893 ... o-sdl-main

Eran
Make sure you have read the HOW TO POST thread
metamorphosis
CodeLite Enthusiast
Posts: 45
Joined: Tue Jan 28, 2014 3:03 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Codelite - all vers v6.x cause compile problem with SDL2

Post by metamorphosis »

eranif wrote:I can't see how this is a codelite problem.
We're discussing a program, Belief is for religious discussions.

eranif wrote:Even though you say nothing has changed, you just replaced 6.0 with 5.4, something did change...
I didn't say nothing had changed, I said that codelite changed from 5.4 to 6.x and nothing else was changed.
Hence the problem is with codelite and nothing else.
eranif wrote:Can you provide a minimal sample that reproduces the problem?
No, I cannot. The project is large.
Yes, I've investigated the error message as well. Those scenarios do not apply to my code.
Gibbon1
CodeLite Expert
Posts: 167
Joined: Fri Jul 22, 2011 5:32 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Codelite - all vers v6.x cause compile problem with SDL2

Post by Gibbon1 »

Can you post build output for 5.4 that works?
metamorphosis
CodeLite Enthusiast
Posts: 45
Joined: Tue Jan 28, 2014 3:03 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Codelite - all vers v6.x cause compile problem with SDL2

Post by metamorphosis »

Found the solution/codelite bug.
The issue is the "Exclude from Build" flag.
What I found was that in 6/7 the first file in the project (main.cpp) had this ticked for no reason,
however opening the same workspace in codelite 5.4 it was not ticked.

This was what caused the error message. Eranif, if you want the workspace file to compare between 5.4 for yourself, PM me and I'll send it to you.
Post Reply