<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.next.codeblocks.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Lucj</id>
	<title>Code::Blocks - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.next.codeblocks.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Lucj"/>
	<link rel="alternate" type="text/html" href="https://wiki.next.codeblocks.org/index.php?title=Special:Contributions/Lucj"/>
	<updated>2026-10-18T20:42:22Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://wiki.next.codeblocks.org/index.php?title=FAQ-Compiling_(errors)&amp;diff=7442</id>
		<title>FAQ-Compiling (errors)</title>
		<link rel="alternate" type="text/html" href="https://wiki.next.codeblocks.org/index.php?title=FAQ-Compiling_(errors)&amp;diff=7442"/>
		<updated>2012-11-15T16:48:47Z</updated>

		<summary type="html">&lt;p&gt;Lucj: New item (vitally hard to find this answer until now) for a specific build issue with permissions windows 7&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Code::Blocks Documentation]]&lt;br /&gt;
__TOC__&lt;br /&gt;
Return to &#039;&#039;&#039;[[FAQ]]&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
==== Q: How do I troubleshoot a compiler problem? ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; I would start by turning on full Compiler logging.&lt;br /&gt;
&lt;br /&gt;
This is done by selecting the &amp;quot;Full command line&amp;quot; option Under menu &amp;quot;Settings&amp;quot; -&amp;gt; &amp;quot;Compiler and Debugger&amp;quot; -&amp;gt; Global compiler settings -&amp;gt; [the compiler you use] -&amp;gt; &amp;quot;Other Setting&amp;quot; tab, &amp;quot;Compiler logging&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This option will make Code::Blocks output the exact commands it uses to compile your code.&lt;br /&gt;
&lt;br /&gt;
Things to remember:&lt;br /&gt;
&lt;br /&gt;
* You should review all the commands and their options;&lt;br /&gt;
* If you have compiled your app before, do a &#039;&#039;re-&#039;&#039;build (or &#039;&#039;clean&#039;&#039; before build) to see all compiling / linking steps;&lt;br /&gt;
* If you don&#039;t know what an option or a command does please read the documentation for the compiler/linker you&#039;re using;&lt;br /&gt;
* Look for missing commands;&lt;br /&gt;
* For every source file (&amp;lt;tt&amp;gt;.cpp&amp;lt;/tt&amp;gt;; &amp;lt;tt&amp;gt;.c&amp;lt;/tt&amp;gt;; &amp;lt;tt&amp;gt;.d&amp;lt;/tt&amp;gt;; etc) in your project, you must have at least one command in the log. This command must produce an object file (file extension &amp;lt;tt&amp;gt;.o&amp;lt;/tt&amp;gt; if using gcc/g++ and &amp;lt;tt&amp;gt;.obj&amp;lt;/tt&amp;gt; if using Visual Studio);&lt;br /&gt;
* Every object file should be linked in the final executable, if not there are undefined symbols errors;&lt;br /&gt;
* Remember the file extension matters: &amp;lt;tt&amp;gt;*.c&amp;lt;/tt&amp;gt; is compiled as C file, &amp;lt;tt&amp;gt;*.cpp&amp;lt;/tt&amp;gt; is compiled as C++ file. [http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html Read more]&lt;br /&gt;
&lt;br /&gt;
==== Q: My simple C++ program throws up lots of errors - what is going on? ====&lt;br /&gt;
&lt;br /&gt;
If you have a C++ program like this:&lt;br /&gt;
&lt;br /&gt;
  #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
  int main() {&lt;br /&gt;
    std::cout &amp;lt;&amp;lt; &amp;quot;hello world\n&amp;quot;;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
and when you compile it you get errors like this:&lt;br /&gt;
&lt;br /&gt;
  fatal error: iostream: No such file or directory&lt;br /&gt;
&lt;br /&gt;
then you have probably given your source file a .c extension. If you do that, the GCC compiler (and others) will probably attempt to compile the file as a C program, not as C++. You should always give your C++ source files the extension .cpp to make sure the compiler handles them correctly.&lt;br /&gt;
&lt;br /&gt;
==== Q: I imported a MSVCToolkit project/workspace, but Code::Blocks insists on trying to use GCC. What&#039;s wrong? ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; A little documentation problem ^^;. The &amp;quot;default compiler&amp;quot; is usually GCC, so when you imported it with &amp;quot;the default compiler&amp;quot;, you told it to use GCC. To fix this situation, go to &amp;quot;Project&amp;quot;, &amp;quot;Build Options&amp;quot; and select VC++ Toolkit as your compiler.&lt;br /&gt;
&lt;br /&gt;
Another possibility is to put the Microsoft compiler as the default one.  To do this, choose &#039;&#039;&#039;&#039;&#039;Settings - Compiler&#039;&#039;&#039;&#039;&#039;, choose the Microsoft compiler in the &#039;&#039;&#039;&#039;&#039;Selected Compiler&#039;&#039;&#039;&#039;&#039; section (top of dialog box) and press the &#039;&#039;&#039;&#039;&#039;Set as default&#039;&#039;&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
From now onwards, for all new projects the Microsoft compiler will be taken by default.&lt;br /&gt;
&lt;br /&gt;
==== Q: When compiling a wxWidgets project, I get several &amp;quot;variable &#039;vtable for xxxx&#039; can&#039;t be auto-imported&amp;quot;. What&#039;s wrong? ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; You need to add WXUSINGDLL in &amp;quot;Project-&amp;gt;Build options-&amp;gt;Compiler #defines&amp;quot; and rebuild your project (or create a new project and use the &amp;quot;Using wxWidgets DLL&amp;quot; project option which adds &amp;quot;-DWXUSINGDLL&amp;quot; to Project-&amp;gt;Build options-&amp;gt;Other options).&lt;br /&gt;
Other errors with the same resolution are:&lt;br /&gt;
&#039;unresolved external symbol &amp;quot;char const * const wxEmptyString&amp;quot; (?wxEmptyString@@3PBDB)&#039; or similar.&lt;br /&gt;
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&#039;s fixed now.&lt;br /&gt;
&lt;br /&gt;
==== Q: I can&#039;t compile a multithreaded app with VC Toolkit! Where are the libraries? ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Sorry, no fix for your problem...&lt;br /&gt;
&lt;br /&gt;
Your problem doesn&#039;t come from CodeBlocks. It exists, because the free VC toolkit (VCTK) doesn&#039;t provide all the libraries and tools which come with Visual C++ (VC) which isn&#039;t free, unfortunately.&lt;br /&gt;
&lt;br /&gt;
Try buying a full-fledged VC++, or even better, download [http://www.mingw.org/ MinGW]&lt;br /&gt;
&lt;br /&gt;
The libraries that can be obtained free of charge are:&lt;br /&gt;
&lt;br /&gt;
Paths:&lt;br /&gt;
 (VCT3) Visual C++ Toolkit 2003 - C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib&lt;br /&gt;
 (PSDK) Platform SDK - C:\Program Files\Microsoft Platform SDK\Lib&lt;br /&gt;
 (NSDK) .NET 1.1 SDK - C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib&lt;br /&gt;
&lt;br /&gt;
C runtime libs:&lt;br /&gt;
 LIBC.LIB 	Single-threaded, static link                                          (VCT3, NSDK)&lt;br /&gt;
 LIBCMT.LIB 	Multithreaded, static link                                            (VCT3, NSDK)&lt;br /&gt;
 MSVCRT.LIB 	Multithreaded, dynamic link (import library for MSVCR71.DLL)          (NSDK)&lt;br /&gt;
 LIBCD.LIB 	Single-threaded, static link (debug)                                  (VCT3, NSDK)&lt;br /&gt;
 LIBCMTD.LIB 	Multithreaded, static link (debug)                                    (NSDK)&lt;br /&gt;
 MSVCRTD.LIB 	Multithreaded, dynamic link (import library for MSVCR71D.DLL) (debug) (NSDK)&lt;br /&gt;
&lt;br /&gt;
C++ libs:&lt;br /&gt;
 LIBCP.LIB 	Single-threaded, static link                                          (VCT3, PSDK)&lt;br /&gt;
 LIBCPMT.LIB 	Multithreaded, static link                                            (VCT3)&lt;br /&gt;
 MSVCPRT.LIB 	Multithreaded, dynamic link (import library for MSVCP71.dll)          (none)&lt;br /&gt;
 LIBCPD.LIB 	Single-threaded, static link (debug)                                  (VCT3)&lt;br /&gt;
 LIBCPMTD.LIB 	Multithreaded, static link (debug)                                    (none)&lt;br /&gt;
 MSVCPRTD.LIB 	Multithreaded, dynamic link (import library for MSVCP71D.DLL) (debug) (none)&lt;br /&gt;
&lt;br /&gt;
Try setting the library linker directories to:&lt;br /&gt;
 C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib&lt;br /&gt;
 C:\Program Files\Microsoft Platform SDK\Lib&lt;br /&gt;
 C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib&lt;br /&gt;
in that order.&lt;br /&gt;
&lt;br /&gt;
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&lt;br /&gt;
meant to work in 32-bit compatibility mode on the 64-bit processors.  Worth a try.  Otherwise, you&lt;br /&gt;
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 &amp;quot;exports.sed&amp;quot; for detailed steps.&lt;br /&gt;
&lt;br /&gt;
See also: [http://wiki.tcl.tk/2435 tclsh script to extract import .lib from (any?) DLL (MinGW)]&lt;br /&gt;
&lt;br /&gt;
See also: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_c_run.2d.time_libraries.asp&lt;br /&gt;
&lt;br /&gt;
See also: http://sapdb.2scale.net/moin.cgi/MS_20C_2b_2b_20Toolkit&lt;br /&gt;
&lt;br /&gt;
==== Q: I get this error when compiling: Symbol &amp;quot;isascii&amp;quot; was not found in &amp;quot;codeblocks.dll&amp;quot; ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Make sure you didn&#039;t mix up the MSVC headers or libs with the MinGW ones.&lt;br /&gt;
&lt;br /&gt;
==== Q: My build fails with multiple &#039;&#039;undefined reference&#039;&#039; errors? ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Example:&#039;&#039;&lt;br /&gt;
 undefined reference to `WSACleanup@8&lt;br /&gt;
 undefined reference to `WSACleanup@0&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Most of the time it is because the required library is not linked with your project. Go to &#039;&#039;Project-&amp;gt;Build options...-&amp;gt;Linker settings (tab)&#039;&#039; and add the required library or libraries.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;VERY&#039;&#039; often you can get help by just googling for the name of the undefined reference, for this example its &amp;quot;WSACleanup&amp;quot;. Usually one of the first links is the SDK documentation, like [http://msdn.microsoft.com/en-us/library/windows/desktop/ms741549%28v=vs.85%29.aspx this from MSDN for WSACleanup]. You&#039;ll find there a lot useful information, including what libraries you need to link against, as for the exsample:&lt;br /&gt;
&#039;&#039;&#039;Requirements&#039;&#039;&#039;&lt;br /&gt;
* Minimum supported client: Windows 2000 Professional&lt;br /&gt;
* Minimum supported server: Windows 2000 Server&lt;br /&gt;
* Header: &#039;&#039;&#039;Winsock2.h&#039;&#039;&#039;&lt;br /&gt;
* Library: &#039;&#039;&#039;Ws2_32&#039;&#039;&#039;.lib&lt;br /&gt;
* DLL: &#039;&#039;&#039;Ws2_32.dll&#039;&#039;&#039;&lt;br /&gt;
The header file &#039;&#039;&#039;Winsock2.h&#039;&#039;&#039; you need to include in your sources. Most likely you have done that already because otherwise you would have gotten a compiler error unable to find the function declaration. The library you need to link against, you can remove any prefix like &amp;quot;lib&amp;quot; and the file extension like &amp;quot;.lib&amp;quot;, &amp;quot;.a&amp;quot; or &amp;quot;.so&amp;quot; - so just type &amp;quot;&#039;&#039;&#039;Ws2_32&#039;&#039;&#039;&amp;quot; in the linker options. Also make sure you have added the path to that library in the linker include path&#039;s options, otherwise the linker will complain that it cannot find that library you want to link against. You also know, that you should distribute &#039;&#039;&#039;Ws2_32.dll&#039;&#039;&#039; for the runtime version of you app, luckily this one usually ships with Windows anyways, so no need to do something here.&lt;br /&gt;
&lt;br /&gt;
==== Q: My build fails in the compile/link/run step with a &#039;&#039;Permission denied&#039;&#039; error? ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; There are several possible causes for this:&lt;br /&gt;
&lt;br /&gt;
# The output directory does not have read/write access.&lt;br /&gt;
#* Either change control settings on the output directory, or move the project to different location.&lt;br /&gt;
# A previous instance of the executable failed to terminate properly.&lt;br /&gt;
#* Open your system&#039;s equivalent of Process/Task Manager, search the list for the name of the executable Code::Blocks is trying to output, and terminate it.&lt;br /&gt;
#* Logging off or rebooting will achieve the same effect.&lt;br /&gt;
# The executable is open.&lt;br /&gt;
#* If the executable is open in a hex-editor or actively being run, close it.&lt;br /&gt;
# Security software is interfering.&lt;br /&gt;
#* The target file is locked while an antivirus programming is scanning it; either wait a few seconds for the antivirus scan to finish, set an exception in the antivirus settings, or (temporarily) disable the antivirus program.&lt;br /&gt;
#* Firewalls with very strict settings sometimes block execution; try reducing the firewall&#039;s settings or adding an exception.&lt;br /&gt;
#* Switching security software may have left traces behind that are interfering; hunt down the remnants of the old antivirus/firewall software and remove them.&lt;br /&gt;
# The file/library cannot be found.&lt;br /&gt;
#* Double check all of the compiler and linker [[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?|search directories]] (including any [[Global compiler variables|variables]] they may be using) are properly setup.&lt;br /&gt;
# Code::Blocks was improperly installed.&lt;br /&gt;
#* Mixing binaries from a stable release and a nightly build (or even two different nightly builds) is highly likely to cause a slew of problems; [[Installing Code::Blocks|reinstall Code::Blocks]] in an empty directory.&lt;br /&gt;
# Multiple installed compilers are interfering with each other.&lt;br /&gt;
#* If they are not required to keep, completely remove all but the most used compiler.&lt;br /&gt;
#* If several compilers are required, ensure that &#039;&#039;&#039;none&#039;&#039;&#039; of them are in the &#039;&#039;system&#039;&#039; path (this is so that Code::Blocks will be able to manage all paths).&lt;br /&gt;
#* Also, do not place any compilers in their default installation path (for example &amp;lt;tt&amp;gt;C:\MinGW&amp;lt;/tt&amp;gt;), as some compilers are hard-coded to look for headers in a default path &#039;&#039;before&#039;&#039; searching their own respective directories.&lt;br /&gt;
# On windows 7, the service &amp;quot;Application Experience&amp;quot; is not running [http://stackoverflow.com/questions/7655471/ld-exe-cannot-open-output-file-permission-denied#answer-7904469 as explained on stackoverflow].&lt;br /&gt;
See also: [/index.php/topic,15047.0.html Permission denied forums discussion]&lt;br /&gt;
&lt;br /&gt;
==== Q: My build fails to link due to &#039;&#039;multiple definition of xyz&#039;&#039; errors? ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; GCC 4.6.1 mingw target (Windows) is known to occasionally (and erroneously) report this if link-time optimization (&amp;lt;tt&amp;gt;-flto&amp;lt;/tt&amp;gt;) is used.&lt;br /&gt;
&lt;br /&gt;
First, of course, check that no token has been defined multiple times. If the source code is clean, and yet the errors persist, adding linker switch (&#039;&#039;Project-&amp;gt;Build options...-&amp;gt;Linker settings (tab)&#039;&#039;)&lt;br /&gt;
 -Wl,--allow-multiple-definition&lt;br /&gt;
will enable the code to link.&lt;br /&gt;
&lt;br /&gt;
See also: [http://sourceware.org/bugzilla/show_bug.cgi?id=12762 Bug 12762]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Return to &#039;&#039;&#039;[[FAQ]]&#039;&#039;&#039;.&lt;/div&gt;</summary>
		<author><name>Lucj</name></author>
	</entry>
</feed>