Difference between revisions of "FAQ"

From Code::Blocks
m (Converted to wiki-links.)
m (→‎Compiling (general): Add link to FAQ 15)
 
(21 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 
[[Category:Code::Blocks Documentation]]
 
[[Category:Code::Blocks Documentation]]
== General ==
+
<!-- Editors, note that the HTML anchors (<span id="..."></span>) are for external websites that have not updated their links; new questions added to the index can safely ignore this. -->
 +
== [[FAQ-General|General]] ==
  
==== Q: What is Code::Blocks? ====
+
* <span id="Q:_What_is_Code::Blocks.3F"></span>'''[[FAQ-General#Q: What is Code::Blocks?|What is Code::Blocks?]]'''
'''A:''' Code::Blocks is an Integrated Development Environment, aka [[wikipedia:Integrated development environment|IDE]]. Thus, a framework for working with source code and using compilers and linkers (in the case of Code::Blocks, these can be several).
+
* <span id="Q:_What_Code::Blocks_is_not.3F"></span>'''[[FAQ-General#Q: What Code::Blocks is not?|What Code::Blocks is not?]]'''
 +
* <span id="Q:_What_licence_is_Code::Blocks_released_under.3F"></span>'''[[FAQ-General#Q: What license is Code::Blocks released under?|What license is Code::Blocks released under?]]'''
 +
* <span id="Q:_When_will_the_next_stable_version_of_Code::Blocks_be_released.3F"></span>'''[[FAQ-General#Q: When will the next stable version of Code::Blocks be released?|When will the next stable version of Code::Blocks be released?]]'''
 +
* <span id="Q:_Is_it_possible_to_integrate_the_win32-help_as_in_dev-cpp.2C_to_get_help_on_the_items_under_the_caret.3F"></span>'''[[FAQ-General#Q: Is it possible to integrate the win32-help as in dev-cpp, to get help on the items under the caret?|Is it possible to integrate the win32-help as in dev-cpp, to get help on the items under the caret?]]'''
  
==== Q: What Code::Blocks is not? ====
+
== [[FAQ-Compiling (general)|Compiling (general)]] ==
'''A:''' Code::Blocks is not a [[wikipedia:Compiler|compiler]], nor a [[wikipedia:Linker (computing)|linker]]. Release packages of Code::Blocks may include a compiler suite (MinGW/GCC), if not provided by the target platform already. However, this is provided "as-is" and not developed/maintained by the Code::Blocks development team.
 
  
==== Q: Is it possible to integrate the win32-help as in dev-cpp, to get help on the items under the caret? ====
+
* <span id="Q:_What_compiler_can_I_use_with_Code::Blocks.3F"></span>'''[[FAQ-Compiling (general)#Q: What compiler can I use with Code::Blocks?|What compiler can I use with Code::Blocks?]]'''
 +
* <span id="Q:_My_project_should_be_compiled_with_a_custom_makefile._Is_it_possible_with_Code::Blocks.3F"></span>'''[[FAQ-Compiling (general)#Q: My project should be compiled with a custom makefile. Is it possible with Code::Blocks?|My project should be compiled with a custom makefile. Is it possible with Code::Blocks?]]'''
 +
* <span id="Q:_I_have_downloaded_MS_VC.2B.2B_Toolkit_2003_for_a_compiler._How_do_I_tell_Code::Blocks_that_it_is_my_compiler.3F"></span>'''[[FAQ-Compiling (general)#Q: I have downloaded MS VC++ Toolkit 2003 for a compiler. How do I tell Code::Blocks that it is my compiler?|I have downloaded MS VC++ Toolkit 2003 for a compiler. How do I tell Code::Blocks that it is my compiler?]]'''
 +
* <span id="Q:_Microsoft_calls_MSVCRT.DLL_a_.22Known_DLL..22_How_do_I_know_if_I_can.2Fshould_use_it.3F"></span>'''[[FAQ-Compiling (general)#Q: Microsoft calls MSVCRT.DLL a "Known DLL." How do I know if I can/should use it?|Microsoft calls MSVCRT.DLL a "Known DLL." How do I know if I can/should use it?]]'''
 +
* <span id="Q:_How_can_I_use_a_DLL_without_DEF_or_LIB_files.3F"></span>'''[[FAQ-Compiling (general)#Q: How can I use a DLL without DEF or LIB files?|How can I use a DLL without DEF or LIB files?]]'''
 +
* <span id="Q:_Where_are_the_libraries_for_the_OpenGL.2C_Ogre3D.2C_SDL.2C_QT.2C_wxWidgets_etc._projects.3F"></span>'''[[FAQ-Compiling (general)#Q: Where are the libraries for the OpenGL, Ogre3D, SDL, QT, wxWidgets etc. projects?|Where are the libraries for the OpenGL, Ogre3D, SDL, QT, wxWidgets etc. projects?]]'''
 +
* <span id="Q:_Is_it_possible_to_use_Visual_C.2B.2B_6.0_with_Code::Blocks.3F"></span>'''[[FAQ-Compiling (general)#Q: Is it possible to use Visual C++ 6.0 with Code::Blocks?|Is it possible to use Visual C++ 6.0 with Code::Blocks?]]'''
 +
* <span id="Q:_I_would_like_to_compile_a_project_using_some_non-standard_libraries._How_can_I_indicate_to_CodeBlocks_that_these_libraries_and_include_files_exist.3F"></span>'''[[FAQ-Compiling (general)#Q: I would like to compile a project using some non-standard libraries. How can I indicate to CodeBlocks that these libraries and include files exist?|I would like to compile a project using some non-standard libraries. How can I indicate to CodeBlocks that these libraries and include files exist?]]'''
 +
* <span id="Q:_How_do_I_use_both_Debug_and_Release_builds_of_wx_libraries.3F"></span>'''[[FAQ-Compiling (general)#Q: How do I use both Debug and Release builds of wx libraries?|How do I use both Debug and Release builds of wx libraries?]]'''
 +
* <span id="Q:_How_do_I_add_version_information_to_windows_executables_and_dll.27s.3F"></span>'''[[FAQ-Compiling (general)#Q: How do I add version information to windows executables and dll's?|How do I add version information to windows executables and dll's?]]'''
 +
* <span id="Q:_Code::Blocks_does_not_force_relink_if_the_library_is_changed.3F"></span>'''[[FAQ-Compiling (general)#Q: Code::Blocks does not force relink if the library is changed?|Code::Blocks does not force relink if the library is changed?]]'''
 +
* <span id="Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F"></span>'''[[FAQ-Compiling (general)#Q: How do I report a compilation problem on the forums?|How do I report a compilation problem on the forums?]]'''
 +
* <span id="Q:_All_of_the_Build_related_options_are_grayed_out.3F"></span>'''[[FAQ-Compiling (general)#Q: All of the Build related options are grayed out?|All of the Build related options are grayed out?]]'''
 +
* <span id="Q:_I_get_a_blank_.28black.29_terminal_window_on_windows.3F"></span>'''[[FAQ-Compiling (general)#Q: I get a blank (black) terminal window on windows|I get a blank (black) terminal window on windows]]'''
 +
* <span id="Q:_My_program_runs_in_codeblocks_but_if_i_start_it_from_the_outside_it_only_flashes_and_closes_immediately.3F"></span>'''[[FAQ-Compiling (general)#Q: My program runs in codeblocks but if i start it from the outside it only flashes and closes immediately| My program runs in codeblocks but if i start it from the outside it only flashes and closes immediately]]'''
  
'''A:''' Yes, this is implemented, but you'll need the help plugin. So if you are using the installer, make sure you enable this plugin.
+
== [[FAQ-Compiling (errors)|Compiling (errors)]] ==
  
==== Q: What licence is Code::Blocks released under? ====
+
* <span id="Q:_How_do_I_troubleshoot_a_compiler_problem.3F"></span>'''[[FAQ-Compiling (errors)#Q: How do I troubleshoot a compiler problem?|How do I troubleshoot a compiler problem?]]'''
 +
* <span id="Q:_What_do_I_need_to_know_when_using_3rd_party_libs.3F"></span>'''[[FAQ-Compiling (errors)#Q: What do I need to know when using 3rd party libs?|What do I need to know when using 3rd party libs?]]'''
 +
* '''[[FAQ-Compiling (errors)#Q: My simple C++ program throws up lots of errors - what is going on?|My simple C++ program throws up lots of errors - what is going on?]]'''
 +
* <span id="Q:_I_imported_a_MSVCToolkit_project.2Fworkspace.2C_but_Code::Blocks_insists_on_trying_to_use_GCC._What.27s_wrong.3F"></span>'''[[FAQ-Compiling (errors)#Q: I imported a MSVCToolkit project/workspace, but Code::Blocks insists on trying to use GCC. What's wrong?|I imported a MSVCToolkit project/workspace, but Code::Blocks insists on trying to use GCC. What's wrong?]]'''
 +
* <span id="Q:_When_compiling_a_wxWidgets_project.2C_I_get_several_.22variable_.27vtable_for_xxxx.27_can.27t_be_auto-imported.22._What.27s_wrong.3F"></span>'''[[FAQ-Compiling (errors)#Q: When compiling a wxWidgets project, I get several "variable 'vtable for xxxx' can't be auto-imported". What's wrong?|When compiling a wxWidgets project, I get several "variable 'vtable for xxxx' can't be auto-imported". What's wrong?]]'''
 +
* <span id="Q:_I_can.27t_compile_a_multithreaded_app_with_VC_Toolkit.21_Where_are_the_libraries.3F"></span>'''[[FAQ-Compiling (errors)#Q: I can't compile a multithreaded app with VC Toolkit! Where are the libraries?|I can't compile a multithreaded app with VC Toolkit! Where are the libraries?]]'''
 +
* <span id="Q:_I_get_this_error_when_compiling:_Symbol_.22isascii.22_was_not_found_in_.22codeblocks.dll.22"></span>'''[[FAQ-Compiling (errors)#Q: I get this error when compiling: Symbol "isascii" was not found in "codeblocks.dll"|I get this error when compiling: Symbol "isascii" was not found in "codeblocks.dll"]]'''
 +
* <span id="Q:_My_build_fails_with_multiple_undefined_reference_errors.3F"></span>'''[[FAQ-Compiling (errors)#Q: My build fails with multiple undefined reference errors?|My build fails with multiple ''undefined reference'' errors?]]'''
 +
* <span id="Q:_My_build_fails_in_the_compile.2Flink.2Frun_step_with_a_Permission_denied_error.3F"></span>'''[[FAQ-Compiling (errors)#Q: My build fails in the compile/link/run step with a Permission denied error?|My build fails in the compile/link/run step with a ''Permission denied'' error?]]'''
 +
* '''[[FAQ-Compiling (errors)#Q: My build fails to link due to multiple definition of xyz errors?|My build fails to link due to ''multiple definition of xyz'' errors?]]'''
 +
* <span id="Q: How can I change the language of the compiler (gcc) output to english?"></span>'''[[FAQ-Compiling_(errors)#Q:_How_can_I_change_the_language_of_the_compiler_.28gcc.29_output_to_english.3F|How can I change the language of the compiler (gcc) output to English?]]'''
  
'''A:''' GNU General Public License 3 ([http://www.gnu.org/licenses/gpl-3.0.html GPL]) with an exception for third party plugins that can be of any license (including closed source) as long as they use only the SDK sources of Code::Blocks.
+
== [[FAQ-Settings|Settings]] ==
  
As an example: If you use the Code::Blocks SDK to develop a plugin, this could be even commercial. When you start using/modifying source code of other parts (i.e. the Code::Blocks core or other GPL3 plugins) the modifications or relevant (affected) parts must be provided as source code, too. However, usually (probably 99.9% of the cases) you'll only need to use the SDK.
+
* <span id="#Q:_How_do_I_get_Code_Completion_to_work.3F"></span>'''[[FAQ-Settings#Q: How do I get Code Completion to work?|How do I get Code Completion to work?]]'''
 +
* <span id="#Q:_How_do_I_make_Code::Blocks_portable.3F"></span>'''[[FAQ-Settings#Q: How do I make Code::Blocks portable?|How do I make Code::Blocks portable?]]'''
 +
* <span id="#Q:_Code::Blocks_option_xyz_is_missing.3F"></span>'''[[FAQ-Settings#Q: Code::Blocks option xyz is missing?|Code::Blocks option ''xyz'' is missing?]]'''
 +
* '''[[FAQ-Settings#Q: How do I change the default location of the output terminal?|How do I change the default location of the output terminal?]]'''
  
== Compiling ==
+
== [[FAQ-Issues and Workarounds|Issues and Workarounds]] ==
  
==== Q: What compiler can I use with Code::Blocks? ====
+
* <span id="Q:_Sometime.2C_in_the_text_editor.2C_space_bar_triggers_Code_Completion.2C_how_do_I_fix_that.3F"></span>'''[[FAQ-Issues and Workarounds#Q: Sometime, in the text editor, space bar triggers Code Completion, how do I fix that?|Sometime, in the text editor, space bar triggers Code Completion, how do I fix that?]]'''
 
+
* <span id="Q:_IDE_is_drawing_the_text_from_Right_to_Left.3F"></span>'''[[FAQ-Issues and Workarounds#Q: IDE is drawing the text from Right to Left?|IDE is drawing the text from Right to Left?]]'''
'''A:''' Code::Blocks philosophy is to be able to use any compiler on earth! Well, almost.
+
* <span id="Q:_All_the_options_in_the_debug_menu_are_grayed_out.3F"></span>'''[[FAQ-Issues and Workarounds#Q: All the options in the debug menu are grayed out?|All the options in the debug menu are grayed out?]]'''
 
+
* <span id="Q:_My_project_works_everywhere_except_one_computer.3F"></span>'''[[FAQ-Issues and Workarounds#Q: My project works everywhere except one computer?|My project works everywhere except one computer?]]'''
As a matter of fact it largely depends on the used compiler plugin. Some provided with the default Code::Blocks installation are GNU GCC (MinGW/Cygwin), MS Visual C++ Free Toolkit 2003, Borland's C++ Compiler 5.5, DigitalMars Free Compiler., OpenWatcom, Small Device C Compiler (SDCC) and others.
+
* <span id="Q:_Syntax_highlighting_is_broken.3B_how_do_I_fix_it.3F"></span>'''[[FAQ-Issues and Workarounds#Q: Syntax highlighting is broken; how do I fix it?|Syntax highlighting is broken; how do I fix it?]]'''
 
+
* <span id="Q:_I_posted_on_the_forums_that_Code::Blocks_was_not_working.2C_but_no_one_could_help_me.3F"></span>'''[[FAQ-Issues and Workarounds#Q: I posted on the forums that Code::Blocks was not working, but no one could help me?|I posted on the forums that Code::Blocks was not working, but no one could help me?]]'''
==== Q: I imported a MSVCToolkit project/workspace, but Code::Blocks insists on trying to use GCC. What's wrong? ====
+
* <span id="Q:_I_cannot_find_any_text_in_my_Code::Blocks_logs.3F"></span>'''[[FAQ-Issues and Workarounds#Q: I cannot find any text in my Code::Blocks logs?|I cannot find any text in my Code::Blocks logs?]]'''
 
+
* <span id="Q:_Scrolling_causes_gray_areas.2Fdistortions_to_obscure_my_code_in_the_editor.3F"></span>'''[[FAQ-Issues and Workarounds#Q: Scrolling causes gray areas/distortions to obscure my code in the editor?|Scrolling causes gray areas/distortions to obscure my code in the editor?]]'''
'''A:''' A little documentation problem ^^;. The "default compiler" is usually GCC, so when you imported it with "the default compiler", you told it to use GCC. To fix this situation, go to "Project", "Build Options" and select VC++ Toolkit as your compiler.
+
* '''[[FAQ-Issues and Workarounds#Q: I cannot type a greater-than '>' sign?|I cannot type a greater-than '>' sign?]]'''
 
+
* '''[[FAQ-Issues and Workarounds#Q:_Using_Code::Blocks_with_high_dpi_screens_and_windows|Using Code::Blocks with high dpi screens and windows]]'''
Another possibility is to put the Microsoft compiler as the default one.  To do this, choose '''''Settings - Compiler''''', choose the Microsoft compiler in the '''''Selected Compiler''''' section (top of dialog box) and press the '''''Set as default''''' button.
 
 
 
From now onwards, for all new projects the Microsoft compiler will be taken by default.
 
 
 
==== Q: My project should be compiled with a custom makefile. Is it possible with Code::Blocks? ====
 
 
 
'''A:''' Yes, you can. You need to change one settings with Code::Blocks 8.02:
 
 
 
a) In your project's Properties, Check "This is a custom makefile".
 
 
 
And that's it! :)
 
 
 
==== Q: I have downloaded MS VC++ Toolkit 2003 for a compiler. How do I tell Code::Blocks that it is my compiler? ====
 
 
 
'''A:''' Click on "Project/Build options" and select the compiler you want for your project/target.
 
 
 
==== Q: When compiling a wxWidgets project, I get several "variable 'vtable for xxxx' can't be auto-imported". What's wrong? ====
 
 
 
'''A:''' You need to add WXUSINGDLL in "Project->Build options->Compiler #defines" and rebuild your project (or create a new project and use the "Using wxWidgets DLL" project option which adds "-DWXUSINGDLL" to Project->Build options->Other options).
 
Other errors with the same resolution are:
 
'unresolved external symbol "char const * const wxEmptyString" (?wxEmptyString@@3PBDB)' or similar.
 
If you were using 1.0-finalbeta and were trying to build a statically linked wxWidgets project, the cause of the problem was some faulty templates. But that's fixed now.
 
 
 
==== Q: I can't compile a multithreaded app with VC Toolkit! Where are the libraries? ====
 
 
 
'''A:''' Sorry, no fix for your problem...
 
 
 
Your problem doesn't come from CodeBlocks. It exists, because the free VC toolkit (VCTK) doesn't provide all the libraries and tools which come with Visual C++ (VC) which isn't free, unfortunately.
 
 
 
Try buying a full-fledged VC++, or even better, download [http://www.mingw.org/ MinGW]
 
 
 
The libraries that can be obtained free of charge are:
 
 
 
Paths:
 
(VCT3) Visual C++ Toolkit 2003 - C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib
 
(PSDK) Platform SDK - C:\Program Files\Microsoft Platform SDK\Lib
 
(NSDK) .NET 1.1 SDK - C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib
 
 
 
C runtime libs:
 
LIBC.LIB Single-threaded, static link                                          (VCT3, NSDK)
 
LIBCMT.LIB Multithreaded, static link                                            (VCT3, NSDK)
 
MSVCRT.LIB Multithreaded, dynamic link (import library for MSVCR71.DLL)          (NSDK)
 
LIBCD.LIB Single-threaded, static link (debug)                                  (VCT3, NSDK)
 
LIBCMTD.LIB Multithreaded, static link (debug)                                    (NSDK)
 
MSVCRTD.LIB Multithreaded, dynamic link (import library for MSVCR71D.DLL) (debug) (NSDK)
 
 
 
C++ libs:
 
LIBCP.LIB Single-threaded, static link                                          (VCT3, PSDK)
 
LIBCPMT.LIB Multithreaded, static link                                            (VCT3)
 
MSVCPRT.LIB Multithreaded, dynamic link (import library for MSVCP71.dll)          (none)
 
LIBCPD.LIB Single-threaded, static link (debug)                                  (VCT3)
 
LIBCPMTD.LIB Multithreaded, static link (debug)                                    (none)
 
MSVCPRTD.LIB Multithreaded, dynamic link (import library for MSVCP71D.DLL) (debug) (none)
 
 
 
Try setting the library linker directories to:
 
C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib
 
C:\Program Files\Microsoft Platform SDK\Lib
 
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib
 
in that order.
 
 
 
The ones listed as (none) above are actually present in the IA64 and AMD64 subdirectories of the PSDK lib directory.  Not sure if these would work on 32-bit windows, however, they may if they are
 
meant to work in 32-bit compatibility mode on the 64-bit processors.  Worth a try.  Otherwise, you
 
can link statically to the C++ library instead of using MSVCP71.dll.  If you really want to link against MSVCP71.dll you can try to create MSVCP71.LIB from the dll using lib.exe and sed.  Search google for "exports.sed" for detailed steps.
 
 
 
See also: [http://wiki.tcl.tk/2435 tclsh script to extract import .lib from (any?) DLL (MinGW)]
 
 
 
See also: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_c_run.2d.time_libraries.asp
 
 
 
See also: http://sapdb.2scale.net/moin.cgi/MS_20C_2b_2b_20Toolkit
 
 
 
==== Q: Microsoft calls MSVCRT.DLL a "Known DLL." How do I know if I can/should use it ? ====
 
 
 
Microsoft does not clearly describe what [http://msdn2.microsoft.com/en-us/library/abx4dbyh.aspx 'Known DLL'] means. A [http://www.zlib.net/DLL_FAQ.txt zLib FAQ entry] makes it much more clear. The short answer is that MSVCRT.DLL is a protected system component and to preserve system integrity it cannot be updated by any end user product installers but may be updated from time to time by system updates. If it works use it. If it doesn't you'll need use a non protected library such as MSVCR70 or MSVCR80 which not only can be updated but private versions can be installed. A small and simple C program is likely to work just fine with MSVCRT.DLL. A large and complex C++ program is more likely to need the additional functionality of MSVCR.
 
 
 
The MSVCRT.LIB that ships with 32 bit compiler Visual C++ Toolkit 2003 dynamically links to MSVCR71.DLL which is not present in a freshly installed Windows XP system. MSVCR only appears after some software package that needs it such as [http://www.adobe.com/ Adobe Acrobat Reader] is installed. This means that programs that depend on MSVCR must redistribute it or risk not working on a substantial percentage of systems for reasons not obvious to either the affected end users or the program supplier.
 
 
 
For projects that can safely use MSVCRT and where it is impractical to redistribute MSVCR, a Win32 MSVCRT.LIB that links to MSVCRT.DLL is available in any [http://www.microsoft.com/whdc/devtools/ddk/default.mspx Device Driver Kit]. It is best to preserve the MSVCRT.LIB provided by the compiler and alter the name of the MSVCRT.LIB extracted from a DDK. List your newly named MSVCRTxx in the lib. If you use MSVCRT.LIB from the Windows 2003 DDK you may encounter the link '''error LNK2001: unresolved external symbol ___security_cookie'''. This can be solved by switching to the MSVCRT.LIB in the Windows XP DDK or by linking '''bufferoverflowU.lib''' found in the Windows SDK. A Win64 MSVCRT.LIB that links to MSVCRT.DLL is available in the Windows SDK or Platform [http://www.microsoft.com/downloads/details.aspx?FamilyId=E15438AC-60BE-41BD-AA14-7F1E0F19CA0D&displaylang=en PSDK].
 
 
 
To prevent problems it is recommended to include both /MD and /NODEFAULTLIB:MSVCRT switches so that problems come up at link time instead of random crashes at run time. Be sure to load your programs into [http://www.dependencywalker.com/ Dependancy Walker] to ensure that functions aren't being linked into both MSVCRxx.DLL and MSVCRT.DLL. It is essential that malloc, calloc, realloc, free, and related memory allocation functions all import from the same DLL.
 
 
 
Source: [http://wiki.tcl.tk/11431 TCL Wiki]
 
 
 
==== Q: How can I use a DLL without DEF or LIB files ? ====
 
 
 
'''A:''' I tried to find a solution, and the following script solved the problem for me. I used a cygwin environment for ''tclsh'' and ''sed'', but the MinGW tools for ''objdump'' and ''dlltool''. See here [http://wiki.tcl.tk/2435 tclsh script to extract import .lib from (any?) DLL (MinGW)]
 
 
 
TODO: Someone might add some informations about problems
 
 
 
Request: Is MinGW or Code::Blocks able to support automatic generation of import libraries ?
 
 
 
See also: http://www.mingw.org/mingwfaq.shtml#faq-msvcdll
 
 
 
See also: http://wyw.dcweb.cn/stdcall.htm
 
 
 
==== Q: Where are the libraries for the OpenGL, Ogre3D, SDL, QT, wxWidgets etc. projects? ====
 
 
 
'''A:''' They're not bundled. The templates were provided for your convenience, but you need to download the libraries on your own.
 
In common terms, "batteries not included" :)
 
 
 
==== Q: Is it possible to use Visual C++ 6.0 with Code::Blocks? ====
 
 
 
'''A:''' Yes. See [[Integrating Microsoft Visual C 6 with Code::Blocks IDE]] for a detailed description on using VC++ 6.0 with Code::Blocks.
 
 
 
==== Q: I get this error when compiling: Symbol "isascii" was not found in "codeblocks.dll" ====
 
'''A:''' Make sure you didn't mix up the MSVC headers or libs with the MinGW ones.
 
 
 
==== Q: I would like to compile a project using some non-standard libraries. How can I indicate to CodeBlocks that these libraries and include files exist? ====
 
'''A:''' You can specify them for your global environment or just for your project.
 
 
 
For global environment :<br />
 
- Menu <i>Settings/Compiler and debugger</i><br />
 
- In the <i>Global compiler settings</i>, select the directories tab<br />
 
- Add the required paths for compiler and linker.<br />
 
<br />
 
For your project :<br />
 
- Right click on the project then select <i>Build options</i><br />
 
- Select the directories tab<br />
 
- Add the required paths for compiler and linker.<br />
 
- Add your specific libraries in the linker tab.<br />
 
- Pay attention to project settings and target settings.
 
==== Q: How do I use both Debug and Release builds of wx libraries? ====
 
'''A:''' I would use the default method of doing it and the default folder naming.
 
 
 
Using these C::B custom varibles
 
WX_SUFFIX=""  // ANSI Release
 
WX_SUFFIX="d"  // ANSI Debug
 
WX_SUFFIX="u"  // Unicode Release
 
WX_SUFFIX="ud"  // Unicode debug
 
 
 
I use WX_CFG when I am using a special configuration
 
WX_CFG="rc3"
 
 
 
Remember, the CodeBlocks globel variable WX needs to point to the wxWidgets folder.
 
 
 
Example minGW build command for "Unicode debug" 2.8.0 RC3
 
 
 
mingw32-make -f makefile.gcc VENDOR=rc3 CFG=rc3 USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=debug  UNICODE=1
 
 
 
"VENDOR=" just puts rc3 in the DLL name; "CFG=" sets which folder the DLL is placed in. In this case in lib\gcc_dllrc3
 
 
 
Before using CFG in the mingw32-make build you need to  do one prior wxWidget build without using it; else the build errors out. (See note below.)
 
 
 
"__WXDEBUG__" must be defined (in the codeblocks project setting) if you wish to link against the  debug version of wxWidgets DLL. Else you will get a runtime error, when you try to run your project output.
 
 
 
Contributed by Tim S
 
 
 
Note:
 
*I have never gotten the following command to work
 
  mingw32-make -f makefile.gcc VENDOR=rc3 CFG=rc3 USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=debug  UNICODE=1
 
 
 
*unless I have first run this command on the same wxWidgets folders
 
  mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=debug  UNICODE=1
 
 
 
*I am guessing that the build without the CFG creates a file or directory needed by the build with the CFG.
 
 
 
==== Q: How do I troubleshoot an compiler problem? ====
 
'''A:''' I would start by turning on full Compiler logging.
 
 
 
This is done by selecting the "Full command line" option Under menu "Settings" -> "Compiler and Debugger" -> Global compiler settings -> [the compiler you use] -> "Other Setting" tab, "Compiler logging".
 
 
 
This option will make Code::Blocks output the exact commands it uses to compile your code.
 
 
 
Things to remember:
 
 
 
* You should review all the commands and their options;
 
* If you don't know what an option or a command does please read the documentation for the compiler/linker you're using;
 
* Look for missing commands;
 
* For every source file (.cpp; .c; .d; etc) in your project, you must have at least one command in the log. This command must produce an object file (file extension ".o" if using gcc/g++ and ".obj" if using Visual Studio);
 
* Every object file should be linked in the final executable, if not there are undefined symbols errors;
 
* Remember the file extension matters: *.c is compiled as C file, *.cpp is compiled as C++ file. [http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html Read more]
 
 
 
==== Q: How do I add version information to windows executables and dll's? ====
 
'''A:''' You need to create a reosurce file with the extension .rc and write the version info there. Then add that file to the Code::Blocks project you are working on.
 
 
 
Sample content of a resource file that you can use and modify for your needs:
 
<pre>
 
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 
 
VS_VERSION_INFO    VERSIONINFO
 
  FILEVERSION      1,0,0,1
 
  PRODUCTVERSION  1,0,0,1
 
  FILEFLAGSMASK    0x3fL // VS_FFI_FILEFLAGSMASK
 
#ifdef _DEBUG
 
  FILEFLAGS        0x1L  // VS_FF_DEBUG|VS_FF_PRIVATEBUILD|VS_FF_PRERELEASE
 
#else
 
  FILEFLAGS        0x0L  // final version
 
#endif
 
  FILEOS          VOS_NT_WINDOWS32
 
  FILETYPE        VFT_APP
 
  FILESUBTYPE      VFT2_UNKNOWN // not used
 
{
 
  BLOCK "StringFileInfo"
 
  {
 
    BLOCK "040904E4" // Lang=US English, CharSet=Windows Multilingual
 
    {
 
      VALUE "Build",            "August 2007\0"
 
      VALUE "Comments",        "Free for personal use only.\0"
 
      VALUE "CompanyName",      "Fake Company\0"
 
      VALUE "Developer",        "The Developer\0"
 
      VALUE "FileDescription",  "Application implementing something\0"
 
      VALUE "FileVersion",      "1.0.000\0"
 
      VALUE "InternalName",    "AppInternalName\0"
 
      VALUE "LegalCopyright",  "Copyright (C) 2007 Fake Company\0"
 
      VALUE "LegalTrademarks",  "All rights reserved.\0"
 
      VALUE "OriginalFilename", "TheEXE.exe\0"
 
      VALUE "PrivateBuild",    "\0"
 
      VALUE "ProductName",      "The EXE\0"
 
      VALUE "ProductVersion",  "1.0.000\0"
 
      VALUE "SpecialBuild",    "\0"
 
      VALUE "Support",          "TheEXE at fake-domain.com\0"
 
      VALUE "Users",            "Unlimited.\0"
 
    } // BLOCK "040904E4"
 
  } // BLOCK "StringFileInfo"
 
  BLOCK "VarFileInfo"
 
  {
 
    VALUE "Translation", 0x409, 1252 // 1252 = 0x04E4
 
  } // BLOCK "VarFileInfo"
 
}
 
</pre>
 
 
 
Also you can use the the [[AutoVersioning plugin|Auto Versioning]] plugin to assist you on the generation of version information. For documentation of the syntax and values used on windows resource files, you can visit the following websites:
 
*http://msdn2.microsoft.com/en-us/library/aa380599.aspx
 
*http://www.cygwin.com/cygwin-ug-net/windres.html
 
 
 
==== Q: Code::Blocks does not force relink if the library is changed? ====
 
 
 
'''A:''' Open ''Project->Properties...->Build targets (tab)'' and select the executable.  Click ''Dependencies...'' and add the name of the library (including its relative path) to ''External dependency files''. Also see [[The build process of Code::Blocks#Using project dependencies|inter-project dependencies]].
 
 
 
''Example:'' <tt>output\myLibrary\libdostuff.a</tt>
 
 
 
==== Q: How do I report a compilation problem on the forums? ====
 
 
 
'''A:''' Try building the project from command line. If the same error comes up, it is a problem with either the source file, the compiler, or the compiler setup. If this is the case, you are unlikely to receive support for it on the Code::Blocks forums, however, [[#Q: How do I troubleshoot an compiler problem?|How do I troubleshoot an compiler problem?]] may help.
 
 
 
If it works fine building from command line, it is either a problem with your project, Code::Blocks' setup, or possibly an actual bug. When posting this problem, include the name of your compiler, operating system, Code::Blocks version, compiler log (go to ''Settings->Compiler and debugger...->Build options (tab)'' and check ''Save build log'' and ''Always output the full command line''), and, if it caused Code::Blocks to crash, the <tt>codeblocks.RPT</tt> file (located in the Code::Blocks installation directory).
 
 
 
''Template: Paste the following template into your post, editing the relevant sections.''
 
OS = ''MyOperatingSystem''
 
CB Version = ''Code::BlocksVersionNumber''
 
Compiler = ''CompilerName CompilerVersionNumber''
 
 
''Description of relevant events.''
 
 
Build log:
 
[code]
 
''Paste build log here''
 
[/code]
 
 
Crash report:
 
[code]
 
''If Code::Blocks crashed, paste the contents of'' codeblocks.RPT ''here.''
 
[/code]
 
 
 
==== Q: All of the Build related options are grayed out? ====
 
 
 
'''A:''' Code::Blocks checks the file extension for individual files before allowing them to be compiled. Save your file with the correct file extension (<tt>*.c</tt> or <tt>*.cpp</tt>).
 
 
 
More often it is useful to [[Creating a new project|create a project]] so that Code::Blocks can manage the entire build.
 
 
 
==== Q: My build fails with multiple ''undefined reference'' errors? ====
 
 
 
''Example:''
 
undefined reference to `WSACleanup@8
 
undefined reference to `WSACleanup@0
 
 
 
'''A:''' Most of the time it is because the required library is not linked with your project. Go to ''Project->Build options...->Linker settings (tab)'' and add the required library or libraries.
 
 
 
If the error includes a line number, it is likely that this is a problem with your code. Track down down your function declarations and implementations. Ensure they all match up, are spelled correctly, and have the correct scope resolution.
 
 
 
== Settings ==
 
 
 
==== Q: How do I get Code Completion to work? ====
 
'''A:''' Did you check how code completion is configured ?
 
See "Settings/Editor", click on "Code-completion and symbols browser" in the left column and check the Code completion and C/C++ parser tabs.
 
 
 
From the 2006/11/30 nightly build, you can also add, in the project properties, directories to be searched when locating a file to parse  .Right click on the project, click on Properties and select the C/C++ parser options.
 
 
 
They're mostly useful when you don't add compiler search dirs in build options but use backticked expressions (e.g. `freetype-config --cflags`). In this case, the parser is not aware of where the source files are located. So, by manually adding the directory in the parser's search dirs you're actually helping the parser find the files.
 
 
 
Of course, backticked expressions are not the only reason these parser search dirs are useful. As another example, I have a set of projects in a workspace. To minimize maintenance overhead, I'm using build scripts to configure these projects. Now, although build scripts are an awesome feature, the C/C++ parser faces the same problem: it doesn't know where to search for files. The parser search directories come to the rescue again.
 
 
 
==== Q: How do I make Code::Blocks portable? ====
 
'''Just the main configuration'''
 
*run / configure C::B as usual
 
 
 
''Note:''
 
Code::Blocks will create a default.conf file that usually is placed into:
 
"C:\Documents and Settings\[your_user_name]\Application Data\codeblocks" (or %APPDATA%) on Windows or your usual home folder ("~/") under Linux.
 
 
 
*place this default.conf file into the directory where the codeblocks binary is
 
*remove the default.conf file from %APPDATA% / home folder respectively
 
*just run C::B from within the C::B path and/or via script / link...
 
 
 
''Note:'' Don't forget to remove all bad hacks you might have done previously that modify %USERPROFILE% and/or %APPDATA% on Windows.
 
 
 
''Note:'' If C::B does not find default.conf (its config) within the %APPDATA% / home folder it looks within the C::B directory (the one where the C::B executable is) next. If there is no config file, too it will be created in the %APPDATA% / home folder. So just make sure you are doing the right thing and C::B is portable just fine.
 
 
 
BTW: This does probably ''not'' apply for any other config file(s) where not C::B is the maintainer but e.g. plugins. The main config file just works like that.
 
 
 
 
 
'''Complete mobile with compiler and plugins'''
 
 
 
An alternative way to make Code::Blocks ''completely'' portable can be achieved by following these steps:
 
*Set up a SVN compiled version (Linux)/a nightly (Windows) in the portable directory of your choice
 
*WINDOWS ONLY: Move your compiler (likely Mingw) into the directory where the nightly Code::Blocks you just set up resides so that you get codeblocks\mingw
 
*Linux systems will have a compiler anyway so that step is not necessary for Linux
 
*Next you will need a script to change your home data variable and launch Code::Blocks
 
*Create a new file in your new Code::Blocks directory (launcher.sh for Linux, launcher.bat for Windows) and open it with an editor
 
*Paste the following script in there and save it:
 
'''LINUX SCRIPT'''
 
#!/bin/bash
 
HOME="`pwd`/settings"
 
mkdir -p "$HOME"
 
./codeblocks $*
 
 
 
'''WINDOWS SCRIPT'''
 
set APPDATA=%~dp0settings
 
mkdir %APPDATA%
 
START /D"%~dp0" codeblocks.exe %* 
 
 
 
*LINUX ONLY: Make the file you just created executable: chmod +x laucnher.sh
 
*You can now launch this by either typing ./launcher.sh (Linux) or by doubleclicking it in Windows
 
 
 
 
 
'''A portable Code::Blocks Launcher for Windows'''
 
[/index.php?action=profile;u=2439 Biplab], an active developer of CB, has released the portable CB loader v0.1.1 in his Blog, and later,
 
[/index.php?action=profile;u=4689 codeur] has made many improvements, and Now, CBlauncher is a part of C::B source code, its code was adopted in the C::B's SVN repository, see [/index.php/topic,10360.msg98052.html#msg98052 Re: Portable Code::Blocks] for more details.
 
 
 
A binary version of CBLauncher can be downloaded from [http://cblauncher.codecutter.org/CbLauncher_1.0.1.zip http://cblauncher.codecutter.org/CbLauncher_1.0.1.zip].
 
The CbLauncher 1.0.1 source code package can be download from
 
[http://cblauncher.codecutter.org/CbLauncher_1.0.1_src.zip http://CbLauncher.codecutter.org/CbLauncher_1.0.1_src.zip], then to build it and run Code::Blocks portable.
 
Or you can check out the C::B's SVN repository, it was located under:
 
http://svn.berlios.de/svnroot/repos/codeblocks/trunk/src/tools/CBLauncher
 
Then, you can build it by opening the project file
 
http://svn.berlios.de/svnroot/repos/codeblocks/trunk/src/tools/CBLauncher/CbLauncher.cbp
 
Steps to use Cblauncher:
 
 
 
#Download a nightly build with revision > 5334.
 
# Extract them to a folder.
 
#Extract CbLauncher.exe to same folder where codeblocks.exe file is present. After extraction, CbLauncher.exe and codeblocks.exe should be in same folder.
 
#Now double click on on CbLauncher.exe file to run Code::Blocks in a portable manner.
 
 
 
Also, see [/index.php/topic,10360.0.html Portable Code::Blocks] for more details.
 
 
 
==== Q: Code::Blocks option ''xyz'' is missing? ====
 
 
 
'''A:''' Many features of Code::Blocks are implemented by means of plugins. First open ''Plugins->Manage plugins...'' and ensure that the one you are trying to use is not disabled. If plugin ''xyz'' is not in the list, it is possible that you removed/disabled it on installation. To acquire the plugin, [[Installing Code::Blocks|reinstall Code::Blocks]] or rebuild from source (double checking that the desired plugin is included).
 
 
 
== Issues and Workaround ==
 
 
 
==== Q: Sometime, in the text editor, space bar triggers Code Completion, how do I fix that? ====
 
 
 
'''A:''' Informations found on the forum.
 
 
 
It's possible to fix this issue editing the keyboard entry in /etc/X1/xorg.conf file. However, some recent distribs use HAL, therefore xorg.conf is empty (since Ubuntu 8.10 for instance). It's also possible to use a setxkbmap tool.<br/><br/>
 
 
 
'''''Hal Solution (Ubuntu 8.10 and above):'''''<br/>
 
 
 
For Ubuntu (and other gnome desktops), another simple solution for the current user is to change a preference.
 
# Menu System => Preferences => Keyboard
 
# Select Tab Layout
 
# Edit "Layout Options..."
 
# Expand last option "Using space key to input non-breakable space character"
 
# Select the last choice "Usual Space at any level"
 
This is not system wide.<br/><br/>
 
 
 
A system wide solution would be to add an fdi file there (for instance)
 
/etc/hal/fdi/policy/99-x11-key_space_fix.fdi
 
put the right thing in it (I did not succeed), unplug your keyboard, plug it again.<br/><br/>
 
 
 
'''''Xorg Solution (prior Hal based distrib):'''''<br/>
 
 
 
as root, edit /etc/X11/xorg.conf and find something like :
 
 
 
Section "InputDevice"
 
        Identifier      "Generic Keyboard"
 
        Driver          "kbd"
 
        ...
 
        Option          "XkbVariant"    "oss"
 
EndSection
 
 
 
Try one of the following workarounds :
 
 
 
1/ you comment the line
 
        Option          "XkbVariant"    "oss"
 
like this
 
#        Option          "XkbVariant"    "oss"
 
 
 
2/ you replace
 
"XkbVariant"  "oss"
 
with
 
"XkbVariant"  "latin9" 
 
 
 
This works for Ubuntu '''prior 8.10''' (before hal)<br/>
 
 
 
It seems that KUbuntu requires the following line:
 
    Option    "XkbOptions"  "nbsp:none"
 
<br/><br/>
 
'''''setxkbmap Solution:'''''<br/>
 
 
 
run this command before running Code::Blocks (works fines for KUbuntu)
 
setxkbmap  -option nbsp:none
 
if it's not enough you can try:
 
setxkbmap  -option nbsp:none -model pc 105 -layout fr -variant latin 9
 
 
 
==== Q: IDE is drawing the text from Right to Left? ====
 
 
 
'''A:''' Uncheck "Settings -> Environment -> View -> Internationalization" and restart Code::Blocks
 
 
 
==== Q: All the options in the debug menu are grayed out? ====
 
 
 
'''A:''' Code::Blocks can only use integrated debugging on an active project.  Start a [[Creating a new project|new project]] and [[Creating a new project#Adding a pre-existing file|add the file]] to it. Also see [[debugging with Code::Blocks]].
 
 
 
''Note: Code::Blocks only supports the GNU GDB and MSVC CDB debuggers.''
 
 
 
==== Q: My project works everywhere except one computer? ====
 
 
 
'''A:''' Some parts of Code::Blocks or the back-end compiler may not support non-ASCII characters (such as é) or possibly spaces. Try moving the project on the affected computer to a directory that contains neither of these in its path.
 
 
 
==== Q: Syntax highlighting is broken; how do I fix it? ====
 
 
 
'''A:''' Code::Blocks cannot know how to highlight your code unless it knows what lexer to use. This is normally automatically determined by the file extension, so it is important to save the file and name it correctly (<tt>*.c</tt> or <tt>*.cpp</tt> for C and C++ code). It is also possible to activate syntax highlighting on a temporary basis. Open ''Edit->Highlight mode'' and select the language the current file is using.
 
 
 
==== Q: I posted on the forums that Code::Blocks was not working, but no one could help me? ====
 
 
 
'''A:''' There is a distinct lack of crystal balls and divining mirrors here, so you may want to post some information. Using this [[#Q: How do I report a compilation problem on the forums?|template]] in your problem description would be a great help.
 
 
 
==== Q: I cannot find any text in my Code::Blocks logs? ====
 
 
 
'''A:''' On MS Windows, wxWidgets sometimes does not show the content of logs at first; scrolling in the log will bring the text to visibility.
 

Latest revision as of 23:08, 16 September 2017

General

Compiling (general)

Compiling (errors)

Settings

Issues and Workarounds