Thread: Recovering Code::Blocks C++ linker settings

  1. #1
    Registered User FortranLevelC++'s Avatar
    Join Date
    May 2013
    Location
    United States
    Posts
    81

    Recovering Code::Blocks C++ linker settings

    Hello, and thank you in advance.

    For more than a year I have been working on a C++ console program by using Code::Blocks, in the Ubuntu Linux environment.

    But today I noticed that the project's compiler and linker settings disappeared from the Project build options menu. The compiler option to enable C++0x is no longer checked, and in the linker options, the GSL libraries that I use (libgsl, libgslcblas, libm) are no longer listed in that menu.

    However, when I rebuild and run the program, it works perfectly. It should not compile without the C++0x option because I use lambdas, and the program should not execute without the GSL libraries (all in the executable, not shared libraries.) I am sure I have rebuilt the program from scratch (in fact, I even manually deleted all the object files even though the "rebuild" option would take care of this.)

    Is there a way I can restore the lost settings that I can no longer see? Since the program compiles and runs correctly, these settings must have been saved even if Code::Blocks crashed and erased some of these settings.

    Many thanks for any suggestions!
    Last edited by FortranLevelC++; 12-04-2014 at 03:20 AM.

  2. #2
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    I think you should use a Makefile (or some build system to generate makefiles) to take care of these issues instead of relying on global IDE settings.
    (Also, is your codeblocks project opened..or just the files ?)

  3. #3
    Registered User FortranLevelC++'s Avatar
    Join Date
    May 2013
    Location
    United States
    Posts
    81
    Quote Originally Posted by manasij7479 View Post
    I think you should use a Makefile (or some build system to generate makefiles) to take care of these issues instead of relying on global IDE settings.
    (Also, is your codeblocks project opened..or just the files ?)
    I have used Code::Blocks to open the entire project, not just the source files. Despite the fact that the compiler and linker options are no longer visible, it appears that when I click "Rebuild Project", it is working flawlessly. Fortunately I had written down the names of the libraries and their paths in my notebook last year, and so I can rebuild the entire project if I have to, but I am surprised that the compiler and linker settings disappeared from the GUI menu.

    I was considering using Makefiles also, but is there a good book that you recommend for Makefiles, to make sure that I acquire a deep knowledge so that can build and maintain big projects with this utility? At least Makefiles are very transparent and universal.

    Also, can you recommend a truly nice editor that I can use with GUI functions like cut and paste, etc, instead of purely manual commands? I like the Code::Blocks because its GUI-based editor is very user-friendly and manageable in comparison the GVim that I have tried before. Even Ubuntu's GUI-Based GVim editor still requires a lot of manual commands. I don't mind learning more manual commands for a really good editor that is readable and intelligently indenting, with good colors to make syntax readable, but GVim is not very readable or user friendly (perhaps because I have not learned how to set it up well.)

    Many thanks for the suggestions.
    Last edited by FortranLevelC++; 12-04-2014 at 05:50 AM.

  4. #4
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    The Project Build options would not have disappeared. Some of them are simply not being displayed.

    The Code::Blocks dialog/window (for the version I have installed on the current machine) has two sections: one section with the project name, and two subordinate build targets (typically targets like "Build" and "Release").

    If you click on the project name, the right hand side of the window shows Compiler Settings, Linker Settings, etc (in separate tabs) that are common for all build targets (I typically enable manage warning levels here or support of dialects I want like C++0x, so get them whenever I build, regardless of which target I select). If you click on the individual Targets, the window will show options specific to each target. For example, it is common for "Debug" target to have an option set to include debugging symbol (which make the executable bigger, but help with stepping through the program when debuggin) while the "Release" target does not typically have that option set.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  5. #5
    Registered User FortranLevelC++'s Avatar
    Join Date
    May 2013
    Location
    United States
    Posts
    81
    Quote Originally Posted by grumpy View Post
    The Project Build options would not have disappeared. Some of them are simply not being displayed.

    The Code::Blocks dialog/window (for the version I have installed on the current machine) has two sections: one section with the project name, and two subordinate build targets (typically targets like "Build" and "Release").

    If you click on the project name, the right hand side of the window shows Compiler Settings, Linker Settings, etc (in separate tabs) that are common for all build targets (I typically enable manage warning levels here or support of dialects I want like C++0x, so get them whenever I build, regardless of which target I select). If you click on the individual Targets, the window will show options specific to each target. For example, it is common for "Debug" target to have an option set to include debugging symbol (which make the executable bigger, but help with stepping through the program when debuggin) while the "Release" target does not typically have that option set.
    Many thanks for the suggestions. I realize that Code::Blocks must have saved the compiler and linker settings because the program compiles and runs after I have used the "Rebuild" option and I have even manually deleted the object files.

    When I reach the menu "Build options", which lists the settings for both the compiler and linker, neither the "Debug" nor the "Release" versions have any linker options listed, even though I have been using the GSL libraries that I have entered when I started the project.

    This is the version 10.05 of Code::Blocks for Ubuntu Linux.

  6. #6
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    What happens if you click on the project name (as opposed to the "Debug" or "Release" targets) and THEN look at the linker options?
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  7. #7
    Registered User FortranLevelC++'s Avatar
    Join Date
    May 2013
    Location
    United States
    Posts
    81
    Quote Originally Posted by grumpy View Post
    What happens if you click on the project name (as opposed to the "Debug" or "Release" targets) and THEN look at the linker options?

    Of course, this is after I have already opened the Code::Blocks project file and after I have the full project in the GUI mode: After I have opened the project, on the left side of the Code::Blocks window, there is "Workspace" and under Workspace, I can see the name of the project with the square-shaped icon (red, green, yellow and blue) of Code::Blocks, and just under the project name the source file names are shown in a tree structure. Now if I right-click on that project name (on the projects window on the left), among the options I notice that I can choose:
    1) "Build options"
    and
    2) "Properties"

    If I choose "Build options" this opens a new window with a sub-page for linker settings, but both the Debug and Release groups show empty linker settings. (And of course, if I click the name of the project there just above "Debug" and"Release", the linker options page is again empty. I do remember having filled the page with the library names and paths when I started the project.

    And if I choose "Properties", it also leads to Build Targets->Build Options window again, and once again the linker settings window is empty there.

  8. #8
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    You're missing my point for a third time.

    In that window with the "sub-pages" (actually called tabs) for compiler settings, linker settings, etc there is also a pane on the same window, to the left of the set of tabs. That pane will have three lines: one has your project name, then there are the targets (indented) i.e. "Debug" and "Release". Click on the project name, as well as the individual targets, and look at the settings you get.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  9. #9
    Registered User
    Join Date
    May 2010
    Posts
    4,532
    Please post the contents of your project's .cbp file, or maybe a picture.

    Recovering Code::Blocks C++ linker settings-projectsettings2-jpg

    Jim

  10. #10
    Registered User FortranLevelC++'s Avatar
    Join Date
    May 2013
    Location
    United States
    Posts
    81
    Quote Originally Posted by grumpy View Post
    In that window with the "sub-pages" (actually called tabs) for compiler settings, linker settings, etc there is also a pane on the same window, to the left of the set of tabs. That pane will have three lines: one has your project name, then there are the targets (indented) i.e. "Debug" and "Release". Click on the project name, as well as the individual targets, and look at the settings you get.
    Many thanks, but that's precisely what I was trying to describe above. I believe that I have tried what you suggested. In the "Project build options" menu, on the left I certainly have the project name and the indented targets "Debug" and "Release". Now when I click on all the three possibilities (Project name and the indented Debug and Release targets), once again the linker settings appear to be empty.

  11. #11
    Registered User
    Join Date
    May 2010
    Posts
    4,532
    Did you ever actually check any of those check boxes? By default all of those check boxes are empty. Once the boxes are checked and the project is saved they should be there the next time you open your project.

    Jim

  12. #12
    Registered User FortranLevelC++'s Avatar
    Join Date
    May 2013
    Location
    United States
    Posts
    81
    Quote Originally Posted by jimblumberg View Post
    Please post the contents of your project's .cbp file, or maybe a picture.

    Recovering Code::Blocks C++ linker settings-projectsettings2-jpg

    Jim
    Many thanks, but this is precisely the window that I have, except that the both the compiler and linker settings are empty. (The only thing that the Debug tab shows is "Produce debugging symbols", but the rest is empty, and more surprisingly, the linker settings are empty even though the program still compiles and runs by successfully using the GSL libraries that my functions depend on. (Even after the project is rebuilt.)

  13. #13
    Registered User FortranLevelC++'s Avatar
    Join Date
    May 2013
    Location
    United States
    Posts
    81
    Quote Originally Posted by jimblumberg View Post
    Did you ever actually check any of those check boxes? By default all of those check boxes are empty. Once the boxes are checked and the project is saved they should be there the next time you open your project.

    Jim
    In the project's compiler options I had certainly checked the box that enables c++0x, and without C++0x the compiler must give an error message because I use lambdas in this project. I do remember the error messages when I forgot to check that box for C++0x in the compiler options last year.

    And separately, the linker settings does not show the tree GSL library names that I have entered a long time ago. I do remember the error messages that I got last year when the linker settings were incorrect, and it took me some effort to enter the library names correctly.

    But in any case, I have just rebuilt the entire project, and as we speak the new executable file (no shared libraries in this version) is running as usual.
    Last edited by FortranLevelC++; 12-04-2014 at 08:12 AM.

  14. #14
    Registered User FortranLevelC++'s Avatar
    Join Date
    May 2013
    Location
    United States
    Posts
    81
    Here is the picture. The code that you see in the editor uses GSL library functions, but the linker settings are empty in the Build options menu, for Debug, Release, or the project name itself. But despite this, the project can be rebuilt from scratch (rebuild option) and it executes normally.

    Recovering Code::Blocks C++ linker settings-screenshot-2014-12-04-07-31-38-jpg
    Last edited by FortranLevelC++; 12-04-2014 at 09:37 AM.

  15. #15
    Registered User
    Join Date
    May 2009
    Posts
    3,824
    FYI: The compiler settings are NOT under the Linker Settings tab!

    Edit: You likely did the bad idea of entering the linker settings under the Global Compiler settings instead of the Project settings.

    Edit2: http://wiki.codeblocks.org/index.php...files_exist.3F

    Tim S.
    Last edited by stahta01; 12-04-2014 at 10:36 AM.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 07-05-2013, 01:15 AM
  2. Code Blocks vs Windows settings?
    By LeonK in forum C++ Programming
    Replies: 2
    Last Post: 06-20-2011, 06:16 AM
  3. MS code::blocks
    By wart101 in forum C++ Programming
    Replies: 11
    Last Post: 12-14-2006, 11:59 AM
  4. Replies: 5
    Last Post: 09-14-2006, 09:47 PM
  5. Dev and Code Blocks
    By swgh in forum Game Programming
    Replies: 3
    Last Post: 04-07-2006, 07:21 PM