Author Topic: C::B doesn't show g++ as a compiler option (MSWindows)  (Read 9850 times)

Offline OldFangle

  • Multiple posting newcomer
  • *
  • Posts: 20
C::B doesn't show g++ as a compiler option (MSWindows)
« on: January 08, 2015, 07:01:08 am »
Hi
I'm new.  Using MSWindows 7 64-bit. 
Installed C::B using codeblocks-13.12mingw.exe
That part's working.
Now trying to figure how to get SFML working with it.
Using CMake I built SFML-2.2. [* note further on]
C:\Program Files (x86)\CodeBlocks\MinGW\bin  is on the System PATH.

Following instructions on http://www.sfml-dev.org/tutorials/2.2/start-cb.php  I'm getting an error message about libstdc++-6.dll . 
Also following instructions on that web page I've configured C::B's Project\Build Options  where Directories are selected for compiler settings, linker settings.  As far as I know I've got paths to \bin, \include, et cetera, entered correctly in those places.
(In #define all I have is SFML_STATIC)

I've been trying to learn what 'entry point' means, and I've read many opinions about that .dll, many solutions offered, which often mention that one must be sure to be using g++ compiler rather than GCC.
Although g++.exe is in the \MinGW\bin  , I can't figure a way to get it to show up in the C::B compiler selection menu.  I can't see it, so can't select it.  But apparently if I could figure how to do that, then with that compiler this .dll problem would be fixed...?

* I built SFML because someone in a Forum message suggested it, but before that I'd installed SFML-2.2-windows-gcc-4.9.2-mingw-32-bit .  I may take a big step back to that point, restart with that package of SMFL, but meanwhile if anyone has dealt with this problem and can share up-to-date tips about how to at least understand what the trouble is and what it means, much obliged.

Thanks
« Last Edit: January 08, 2015, 09:44:53 pm by OldFangle »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: C::B doesn't show g++ as a compiler option (MSWindows)
« Reply #1 on: January 08, 2015, 07:01:22 pm »
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F

Post a full re-build log and you might get some help.
Do NOT and I will just ignore you.

Edit: The CB default Toolchain name for MinGW GCC C/C++ is likely "GNU GCC Compiler"

Tim S.
« Last Edit: January 08, 2015, 07:13:19 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline OldFangle

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: C::B doesn't show g++ as a compiler option (MSWindows)
« Reply #2 on: January 08, 2015, 09:17:31 pm »
Post a full re-build log and you might get some help.
Edit: The CB default Toolchain name for MinGW GCC C/C++ is likely "GNU GCC Compiler"

Thanks for the link.

According to what I've been reading about GCC and g++, they are different in certain important ways, and g++ is what I should have as a compiler in order to avoid the error message I'm finding.

I don't have access to g++  and that's the problem, not any problem with g++ behaviour during a build/run.

I'm trying to figure how to get g++ to show up in the compiler selection menu so that I can select it.

GCC is the default selection but g++ isn't visible in that menu and I've read that they're not precisely the same compiler.

Thanks again.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: C::B doesn't show g++ as a compiler option (MSWindows)
« Reply #3 on: January 08, 2015, 09:18:51 pm »
You are on my list of people to ignore.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline OldFangle

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: C::B doesn't show g++ as a compiler option (MSWindows)
« Reply #4 on: January 08, 2015, 09:26:26 pm »
You are on my list of people to ignore.

Why?  I'm explaining this as best I can.  I can't build anything with g++ because I can't access it yet.  There's no log, there's nothing to show.  The only compiler error at this point is my inability to understand how to get the g++ compiler on a path so that code::blocks can include it in the selection menu.

Cheers

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: C::B doesn't show g++ as a compiler option (MSWindows)
« Reply #5 on: January 08, 2015, 09:37:50 pm »
You are on my list of people to ignore.

Why?  I'm explaining this as best I can.  I can't build anything with g++ because I can't access it yet.  There's no log, there's nothing to show.  The only compiler error at this point is my inability to understand how to get the g++ compiler on a path so that code::blocks can include it in the selection menu.

Cheers


read exactly what stahta01 has written:
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F
Post a full re-build log and you might get some help.
Do NOT and I will just ignore you.

I think you are obsess about this gcc and g++ stuff... Many other people use SFML without modifying the tool chain like you want to do...
unless you follow the instructions stahta01 gave you we won't be able to help you....

PS. i think you have installed multiple compilers, or messed somehow with the paths, and installation directories (ex. why is CMake in your c::b folder???)...

greetings

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: C::B doesn't show g++ as a compiler option (MSWindows)
« Reply #6 on: January 08, 2015, 10:02:36 pm »
Just to make it clear:
gcc hast two meanings Gnu Compiler Collection and gnu c-compiler.
The first one is the name of the so called toolchain, where all used executables are defined (see "Settings -> Compiler -> ...").
Inside this toolchain the c++-compiler (g++) and the c-compiler (gcc) are defined (and some other linking and debugging related stuff).
Normally it should work out of the box. You might need to adjust the compiler installation directory (at least on windows). If yes, try the "Auto detect"-button.
The executable names might differ on windows you can have e.g. mingw32-g++.exe or mingw64-g++.exe instead of just g++.exe, there might also be some suffix like -dw2 or -sjlj, that depends on you installation.

Offline OldFangle

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: C::B doesn't show g++ as a compiler option (MSWindows)
« Reply #7 on: January 08, 2015, 10:35:54 pm »
Hello everyone

(First of all thanks for the typo alert.  Yeah, g++.exe would be in CodeBlocks\MinGW\ , not CodeBlocks\CMake\  *sigh*)

Next, thank you for helping me understand that the default C::B setting, GCC, is in this case a kind of container in which the presence of g++ is implicit.

If it's already selected that way, then yes, I understand that the next step is to try to Build/Run a project and get a Build Log of the result of the attempt.

I'll get to work on that now.

Cheers, everyone.  Thanks for everyone's attention and time.

Offline OldFangle

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: C::B doesn't show g++ as a compiler option (MSWindows)
« Reply #8 on: January 08, 2015, 10:49:10 pm »
Hello again, here's the Build Log...
>>>
-------------- Build: Debug in 2015-01-06_02 (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -fexceptions -DSFML_STATIC -g -ID:\SFML-2.2\include -ID:\SFML-2.2\bin -I"C:\Program Files (x86)\CodeBlocks\MinGW\bin" -I"C:\Program Files (x86)\CodeBlocks\MinGW\mingw32\bin" -ID:\SFML-2.2\include -ID:\SFML-2.2\include\SFML -c D:\_PROJECT_CODING\2015-01-06_02\main.cpp -o obj\Debug\main.o
mingw32-g++.exe -LD:\SFML-2.2\lib -LD:\SFML-2.2\bin -LD:\SFML-2.2\lib -o bin\Debug\2015-01-06_02.exe obj\Debug\main.o   -lsfml-graphics -lsfml-window -lsfml-system
Output file is bin\Debug\2015-01-06_02.exe with size 744.51 KB
Process terminated with status 0 (0 minute(s), 3 second(s))
0 error(s), 0 warning(s) (0 minute(s), 3 second(s))

-------------- Run: Debug in 2015-01-06_02 (compiler: GNU GCC Compiler)---------------

Checking for existence: D:\_PROJECT_CODING\2015-01-06_02\bin\Debug\2015-01-06_02.exe
Executing: "C:\Program Files (x86)\CodeBlocks/cb_console_runner.exe" "D:\_PROJECT_CODING\2015-01-06_02\bin\Debug\2015-01-06_02.exe"  (in D:\_PROJECT_CODING\2015-01-06_02\.)

<<<

...And here's the error message in the pop-up window:
>>>
The procedure entry point _ZSt24__throw_out_of_range_fmtPKcz could not be located in the dynamic link library libstdc++-6.dll
<<<

My rather simple objective is to figure how to help C::B or/and SFML-2.2 find the support files they need.
I'm not perfectly clear on when to use in-house .lib, or else when inclusion of .dll files is unavoidable.
I'm aiming to make some standalone utilities so I've been trying to compile 'statically'.

Thanks again

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: C::B doesn't show g++ as a compiler option (MSWindows)
« Reply #9 on: January 08, 2015, 11:07:17 pm »
I suggest using the same compiler to build both the library and the code using the library.

At least you posted the build log and clarified that the error is a run-time error.

Do you know which GCC version/toolchain was used to build the library?

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: C::B doesn't show g++ as a compiler option (MSWindows)
« Reply #10 on: January 08, 2015, 11:31:00 pm »
Build using Code::Blocks 13.12 using TDM MinGW GCC 4.71 and Downloaded file from http://www.sfml-dev.org/download/sfml/2.2/ GCC 4.7.1 TDM (SJLJ) - 32-bit the code runs.

The OP needs to learn to program and read directions.
Edit4: FYI: I did NOT do the debug target correctly per these directions in the attached CB Project.
Quote
The settings shown here will result in your application being linked to the dynamic version of SFML, the one that needs the DLL files. If you want to get rid of these DLLs and have SFML directly integrated into your executable, you must link to the static version. Static SFML libraries have the "-s" suffix: "sfml-xxx-s-d" for Debug, and "sfml-xxx-s" for Release.
In this case, you'll also need to define the SFML_STATIC macro in the preprocessor options of your project.
Edit2: The directions that the OP likely failed to follow.
Quote
Starting from SFML 2.2, when static linking, you will have to link all of SFML's dependencies to your project as well. This means that if you are linking sfml-window-s or sfml-window-s-d for example, you will also have to link opengl32, winmm and gdi32. Some of these dependency libraries might already be listed under "Inherited values", but adding them again yourself shouldn't cause any problems.

I used the directions as a hint and I got it to work.
I used CB Global Variable to location of Library.
I attached zipped CB project.

Edit3 build log because I cut and pasted the old CB Project instead of the zipped one.
Code
-------------- Clean: Release in SFML (compiler: GNU GCC Compiler)---------------

Cleaned "SFML - Release"

-------------- Build: Release in SFML (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -DSFML_STATIC -O2 -IC:\SourceCode\OpenSourceCode\Libs\GUI\SFML\SFML-2.2-windows-gcc-4.7.1-tdm-32-bit\SFML-2.2\include -c C:\test\SFML\main.cpp -o obj\Release\main.o
mingw32-g++.exe -LC:\SourceCode\OpenSourceCode\Libs\GUI\SFML\SFML-2.2-windows-gcc-4.7.1-tdm-32-bit\SFML-2.2\lib -o bin\Release\SFML.exe obj\Release\main.o  -s  -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -lglew -lfreetype -ljpeg -lopengl32 -lgdi32 -lwinmm
Output file is bin\Release\SFML.exe with size 1002.50 KB
Process terminated with status 0 (0 minute(s), 1 second(s))
0 error(s), 0 warning(s) (0 minute(s), 1 second(s))

[attachment deleted by admin]
« Last Edit: January 08, 2015, 11:42:12 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline OldFangle

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: C::B doesn't show g++ as a compiler option (MSWindows)
« Reply #11 on: January 08, 2015, 11:50:40 pm »
I suggest using the same compiler to build both the library and the code using the library.
...
Do you know which GCC version/toolchain was used to build the library?

If you mean the .lib files, the Code::Blocks I'm using is an .exe installation, I didn't build it from source code.
How may I check to see how its library was built?

Offline OldFangle

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: C::B doesn't show g++ as a compiler option (MSWindows)
« Reply #12 on: January 09, 2015, 12:11:37 am »
> Build using Code::Blocks 13.12 using TDM MinGW GCC 4.71 [snip]

OK

> The OP needs to learn to program and read directions.

I'm finding references to "OP" and "OP CodeBlocks" but not a definition.  What is it?

> FYI: I did NOT do the debug target correctly per these directions in the attached CB Project.

I'm likely having the same problem.  I've been watching for those -s suffix files.  I may have entered SFML_STATIC in the wrong place.  It's in projects > build options > #define .

> when static linking, you will have to link all of SFML's dependencies to your project as well. This means that if you are linking sfml-window-s or sfml-window-s-d for example, you will also have to link opengl32, winmm and gdi32. Some of these dependency libraries might already be listed under "Inherited values", but adding them again yourself shouldn't cause any problems.
//

Yes I did forget to learn more about that.  I forgot to look for those and make sure they're on a link path.

> I used CB Global Variable to location of Library.

I don't know what that means.  If it's a shorthand command I haven't seen it or learned it yet.

> -------------- Clean: Release in SFML (compiler: GNU GCC Compiler)---------------
> Cleaned "SFML - Release"

I still need to learn this.  Whatever was said in a tutorial about Cleaning a Release, didn't impact itself for its meaning or importance at the time.

----------

Thank you for all the pointers and leads.  I'll start with that Code::Blocks 13.12 using TDM MinGW GCC 4.71 installation and then work through the whole of the message that follows.

Thank you again.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: C::B doesn't show g++ as a compiler option (MSWindows)
« Reply #13 on: January 09, 2015, 12:41:00 am »
OP means Original Poster.
CB means Code::Blocks
GV means Global Variable  http://wiki.codeblocks.org/index.php?title=Global_compiler_variables

Did not see anything I missed; if it still does NOT work after adding the "-s" or "-s-d" to the library post the new build log.

NOTE: Your run-time error was because you where linking to the DLL libs instead of the static libs like the define implied; adding the "-s" or "-s-d" is the proper way to use the static SFML libs.
Note, if you had added the SFML bin folder to the CB Project library search path the error would have changed or maybe even went away.

Tim S.
« Last Edit: January 09, 2015, 12:48:49 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: C::B doesn't show g++ as a compiler option (MSWindows)
« Reply #14 on: January 09, 2015, 01:13:14 am »
I suggest using the same compiler to build both the library and the code using the library.
...
Do you know which GCC version/toolchain was used to build the library?

If you mean the .lib files, the Code::Blocks I'm using is an .exe installation, I didn't build it from source code.
How may I check to see how its library was built?

The URL you posted said there was two major choices.
1. Downloading a prebuilt SFML library
2. Building the SFML library yourself.

You need to know which one you did!
If you downloaded a SFML library it needs to match the compiler being used to build the CB Project.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org