Configuring MSVC debugger in code::blocks - c++

I am using code::blocks.
I set up the MSVC compiler(downloaded the MSVC Express 2010 Compiler and then added SDK directories).
The project does compile, however when I try to debug it ingores the breakpoints I set.
If I go Settings->Compiler->Toolchain Executables, the chosen Compiler is GDB/CDB : Default.
I guess the problem is gdb cannot debug msvc code. But how do I add a ne debugger?
In Settings->Debugger there is only one option of GDB/CDB compiler and I cannot add new one.
I tried adding additional directories, but it doesn't help.
So how do I make it work?
thanks

It's in Settings/Debugger and not in in Settings/Compiler/Toolchain Executables.

Got the same problem... I set path for cdb in code::blocks, ensured that the compiler added debug info, did everything I found on google (set Symbol Path to some weird stuff as described here: http://forums.codeblocks.org/index.php/topic,8454.msg63355.html#msg63355 and here: http://msdn.microsoft.com/en-us/library/windows/hardware/hh439323%28v=vs.85%29.aspx) - and still nothing. I didnt have any errors in debuger log, but it still wouldn't work. Finally - EUREKA: http://wiki.codeblocks.org/index.php?title=Debugging_with_Code::Blocks#Path_with_spaces
Breakpoints could not work if the path/folder you've placed your
project contains spaces or other special characters. To be safe use
English letters, digits and '_'.
After changing " " to "_" in directory names - everything works fine. And I lost only 5 hours for that...

Related

Xcode says "You don't have permission" when trying to run. Tried a lot of solutions from here [duplicate]

Whenever I try to run my app in Xcode 6 Beta 4 I am getting the error:
The file "MyApp.app" couldn't be opened because you don't have permission to view it.
This error appears no matter what simulator or device I target.
I have tried:
Deleting all Derived Data from Organizer in Xcode
Repairing permissions on my drive
Manually elevating the permissions of the built MyApp.app
Restarting my computer
Has anyone else run into this problem and found a solution?
I use Xcode6 GM. I encountered the same problem. What I did was to go to Build Settings -> Build Options. Then I changed the value of the "Compiler for C/C++/Objective-C" to Default Compiler.
Having the problem on DEVICE too (not just simulator)?
The other solutions only fixed it for me on simulator, not device.
For me this problem occurred (in Xcode 6) when I would try to change the main info.plist properties whilst trying to change my app name.
In info.plist I had changed Executable File name to something other than the default ${EXECUTABLE_NAME}...
I had mistaken this field for the field that changes the name of the app under the icon on the springboard.
In Xcode do the following
Window --> Organiser --> Projects --> The app with the issue --> delete button in Derived Data.
I then cleaned the project and voila
works
For me, a simple Product -> Clean worked great
I've fixed it by cleaning a build folder. Just went to 'Product' menu and Option+Click 'Clean'. After that a problem was resolved.
There was a problem with the Info.plist of the project. I created a new project with the same name in Xcode 6 beta 4 and then replaced the real project's Info.plist with the new one. The project then built and ran fine.
Look at the diff, it appears like the plist might have somehow gotten mixed up with a playground's plist. The bundle identifier was "com.apple.dt.playground.iOS-18300-13" and the executable and bundle names were "iOS" along with some other oddities.
This is the full diff in case anyone needs it for reference:
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
- <string>iOS</string>
+ <string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
- <string>com.apple.dt.playground.iOS-18300-13</string>
+ <string>com.myCompany.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
- <string>iOS</string>
+ <string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
- <string>AAPL</string>
+ <string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
- <key>CFBundleSupportedPlatforms</key>
- <array>
- <string>iPhoneSimulator</string>
- </array>
+ <key>CFBundleSignature</key>
+ <string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
- <key>DTPlatformName</key>
- <string>iphonesimulator</string>
- <key>DTSDKName</key>
- <string>iphonesimulator8.0</string>
- <key>LSBackgroundOnly</key>
- <true/>
<key>LSRequiresIPhoneOS</key>
<true/>
+ <key>UIMainStoryboardFile</key>
+ <string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
</dict>
</plist>
I've had same this error in Xcode 8.2. The reason I found out for me, another Info.plist is added in my project while adding library (manually copy).
So that Xcode is getting confused for selecting correct Info.plist.
I just removed that Info.plist from the added library.
Then it is working fine without any permission alert.
Please check if you have changed Executable file => $(EXECUTABLE_NAME) to any other name. If you have changed this name then it shows this error. Please replace it with $(EXECUTABLE_NAME).
Product -> Clean (command shift K) fixed it for me
My goodness!! I spent hours to resolve this issue.
On XCode 7.3 I was having project with no issues.
Mistake I did
I just Added physical folders and moved my files into them, problem started.
I tried everything
Default compiler
Clean and build
Reset simulator and reboot simulator, Xcode, iPhone even mac
Updated Info.plist
Deleting Derived Data
Editing the permission on the folder of the project
Checking my architectures
nothing worked :(
How I resolved
I was about create new project and then I just deleted those physical
folders I added, clean build and YESS!!
It works!!
Try "cmd+shift+k" to clean the project and rebuild. At least it worked for me
Sometimes opening old project in new version Xcode will get this message.
Go to Issue navigator and follow the warning hint 'Upate to reconmmented settings'.
Boom, magic!
I had similar issue (xCode 6.2) for sample code downloaded. I tried to set Executable Name to Default in Info.plist but this didn't worked.
Instead change Compiler for C/C++/Objective-C to Default compiler (Apple LLVM 6.0) instead of Unsupported Compiler(com.apple.compilers.llvmgcc42) for project.
My Application was working fine on XCode 9.4, but when I opened my project in XCode 10 I was experiencing this issue. For me the issue was the build setting. I found the answer in this page https://forums.developer.apple.com/thread/112141.
In short go to File > Workspace Settings… > Build System and change it to "Legacy Build System"
1) Go Firstly Build Options.
2) Then changed the value of the "Compiler for C/C++/Objective-C" to Default Compiler.
clean and working :-)
I found that changing my compiler to LLVM 6.0 in the Build Options was enough for me (xcode 6.1)
I got same error on my Xcode 6.1.1 for a project downloaded from gitHub which was committed 4 years ago.
For me, setting Architectures to the default value Standard architectures(armv7,arm64) and Compiler for C/C++/Objective-C to Default Compiler in Building Settings worked.
I had the same issue in my project. Later on found that third-party (fmdb for SQLite) file used in project contained Info.plist.
Simply deleting the Info.plist file worked for me!
I recently meet the same problem for running an old project (initially created in Xcode 4.x) in Xcode 6.0.1.
I fixed the problem by changing the Architectures in Building Settings to the default value, which is "Standard architectures(armv7,arm64)".
Hope this could help anyone who got similar problems :)
I've had this error with a number of my older projects that I am getting out of the cupboard to update. It seems that using Xcode 6 with older code seems to bring this about for some reason.
I have fixed this in all projects that I have done this with by:
Delete Derived Data
in Product: do a clean
go to Build Settings in the project Target and go to Build Options and change the value of the "Compiler for C/C++/Objective-C" to 'Default
Compiler'.
I tried all of the listed answers and none of them was useful. The problem was due to existence of an another plist file linked from a submodule via cocoapods. Luckily this was my own module, so I just deleted this plist from the submodule project and reinstalled pods.
solution
Later on I understood that the key of the problem was in the name of that second plist: simply info.plist. You may rename the file and relink it via a sources section of a submodule
That second plist file had a unique name, so Xcode was not supposed to become frustrated. Even my target settings pointed on a main plist, not on a info.plist. Looks like Xcode takes special consideraions about that name
The bug reproduced in Xcode 6.4 and Xcode 7.0
Well in my case, I just rename the Bundle Name and Executable file values in info.plist same as project name. It worked for me.
What I did is here:
I deleted VALIDARCHS from Project
I deleted VALIDARCHS from Target
Build Active Architecture Only = YES (for Debug) Architectures
Standard Architectures $(ARCHS_STANDARD)
Also, File -> Project/Workspace Settings == New Build System
Xcode Version 12.0 (12A7209)
I had this similar problem. Somehow my value for the key Executable File got mixed up. Just change it back to ${EXECUTABLE_NAME} (Under your project > Info). Worked for me!
If you google the text of this error message you will find maybe 20 threads across StackOverflow, Apple dev forums, Reddit, etc. about Xcode failing to be able to run a compiled executable with this error message.
In these threads you will find many people offering various suggestions about how to fix the problem: changing product name to match project name, changing build phase options, something with info.plist, changing compilers to or from Clang, etc. Presumably the suggestions are offered in good faith because they solved the problem for someone, but the answers are so varied that it is clear that the error message is generic and this is an important point if you are receiving it: this error seems to mean that something is wrong with the binary. Ignore its actual text: it may have nothing to do with permissions.
There is no general solution to this error. The error message is totally generic; assume it means "bad binary file". The solution if you are receiving it depends on what you are trying to do, what has changed, why you are seeing this error all of a sudden. Google the specifics of your situation rather than this error message.
In my case, and I have a feeling this is a common case, what I was trying to do was build an old iOS project, nine years old I think, on modern Xcode. The solution was to switch to the legacy build system which led to a compilation error because in the old project there were not modern architecture targets, which could be fixed by manually adding them.
In my case main.m containing the main(...) function was not contained in the list of "Compile Sources" in "Build Phases". To check if this is the case, enter into Build Phases and look, if your main.m appears in the "Compile Sources" list.
Don't know if the problem is related but maybe it can be a solution for anyone pulling the hairs like me.
In my case, I have a project with a lot of targets. Each target is a customisation of that base project which is a Cocoa Touch Static Library and the targets, Applications. Even if the main file is added into the library compilation, but not in each target, that error message appears. So what I did? Manually added the main file to each target in the Compile Sources section and bingo, all fine.
For me the error was in the .plist file at the key CFBundleExecutable.
I had renamed the executable removing a space that was between two words. (Eg: from "Wild Racer" to "WildRacer"). Took 1 day to spot it!!
Xcode is soooo unhelpful in the debugging!
What solved it for me was setting Build Active Architecture Only from No to Yes.
with X-code 6.3.2
[Build Settings] Options.
[All]-[Build Options]-[Compiler for C/C++/Objective-C]-[Default compiler (Apple LLVM 6.1)]
Then rebuild the project, and it runs ok.

Visual Studio - DLL dependency not found DESPITE Environment variable being set

I have written a C application that depends on a few DLLs and am having some trouble when using the local debugger. It's this well documented error message:
"This program can't start because xxx.dll is missing from your
computer."
Right now it's portaudio_x86.dll but the DLL is arbitrary as I'm getting the same behaviour for a bunch of others (libfftw3-3.dll, libsamplerate-0.dll, libsndfile-1.dll...)
I have been to Configuration Properties\Debugging and changed the Environment to:
PATH =
C:\portaudioASIO\portaudio\lib;%PATH%
(where the portaudio dll is)
and Merge Environment is 'Yes' (I've tried every combination and permutation of the PATH with appending, prepending, having $(ProjectDir) in the mix - all to no avail)
but this doesn't resolve it and I still get the error message "dll not found" when I debug.
I'm currently working around it by including the DLLs in the debug folder but this seems like a bit of a hack to me and from reading all the other posts [ 1, 2, 3 ] about setting the Environment PATH variable I can't see why it doesn't work.
Any tips on how to get the PATH variable to behave properly ? Cheers!
This is using MSVS Community 2015, the app is in C but the same thing happens with a C++ version.

Step into STL sources in Xcode 5

I've been using Xcode 5 for a while now and I can't figure out how to debug into the STL source headers. The option "Step Into" (F7) just skips over the statement I would like the debugger to step into, and I don't find a setting to change this behavior. I remember people complaining about previous versions of Xcode where stepping into the STL sources could not be turned off... it's frustrating.
There is a setting in lldb that controls this:
(lldb) settings show target.process.thread.step-avoid-regexp
target.process.thread.step-avoid-regexp (regex) = ^std::
As you see, by default it is set not to step into anything in the std namespace. Just make a file called .lldbinit in your home directory, and put in that:
settings set target.process.thread.step-avoid-regexp ""
and we will no longer skip over functions in std.

Disable Eclipse's error discovery. (Codan false positives)

My experience until now is, that the error discovery of Eclipse is horribly buggish without any solutions (Tried __GXX_EXPERIMENTAL_CXX0X__, -std=c++0x, -std=c++11 in nearby every point of the settings). I am at the point that I dont want to search for a solution no more. Now I just want to see solely real compiler errors. But how to accomplish this?
UPDATE: It's been a long time since I posted the original answer and it has become outdated. I double-checked today (Mar 15, 2014): in Eclipse Kepler (Build id 20130614-0229) it is sufficient to
add under Project > Properties > C/C++ Build > Settings then on the Tool Settings tab GCC C++ Compiler > Miscellaneous the -std=c++11 flag,
then under Window > Preferences > C/C++ > Build > Settings on the Discovery tab chose CDT GCC Built-in Compiler Settings and add the -std=c++11 flag to Command to get compiler specs. On my machine it looks like this after the change:
${COMMAND} -E -P -v -dD -std=c++11 "${INPUTS}"
clean and rebuild both your project and your index (Project > C/C++ Index > Rebuild) as Eclipse tends to cache error messages and show them even though they are gone after changing the settings.
This works on my machine for sure. If it doesn't on yours, then you might want to give a shot to this: C++11 full support on Eclipse although I am neither sure about the correctness of this approach nor was it necessary to do it on my machine. As of March 7, 2014 users claim that it helped them whereas the above approach didn't.
The original post from 2012, now outdated:
These bogus errors come from Codan. I also issued a bug report (C++03!!!) but the same problem shows up in the latest stable Eclipse so I don't think much has happened :(
Workaround:
Click on the project properties, then C/C++ General > Code Analysis > Syntax and Semantic Errors and deselect whatever false errors you are getting.
I just want to see solely real compiler errors
Of course, you can disable there the static analysis completely, in that case you can accomplish exactly what you want.
UPDATE: 2 users have reported that what Jeevaka wrote helped them. I have tried what he wrote, it did not help me with Juno SR1 and CDT 8.1.1. Perhaps Codan developers have improved static analysis in Juno SR2 and CDT 8.1.2
I was troubled by Cordian errors for c++11 code that compile perfectly in gcc with all warnings enabled as well. I found what I think is the root cause, at least it was in my case. Few other questions on Cordian errors for c++11 are closed as duplicates of this question and point to this question. So I though I would post my answer here.
This is what I found:
Project Properties > C++ General > Preprocessor … > Entries > GNU C++ > CDT GCC Builtin Compiler Settings has *__cplusplus=199711L* as one of the entries.
I changed it as follows:
In the Window > Preferences > C/C++ > Build > Settings > Discovery tab selected CDT GCC Builtin Compiler Settings and changed ${COMMAND} -E -P -v -dD ${INPUTS} to ${COMMAND} -E -P -v -std=c++11 -dD '${INPUTS}'. Then hit Apply.
The errors were gone after next build.
I am using Juno SR2 with CDT 8.1.2 and handmade make files.
Adding a little more color:
I am no expert, but here is what I think happened in my case:
Cordian gather errors in multiple ways.
One is parsing the compiler output. -std=c++11 in my Makefile ensured that this part worked right all along as invoking the same Makefile through terminal didn't flag any errors.
Another is through 'Code Analysis'. For this, and probably for other tasks, Ecplise need to know the settings that compiler would use. Eclipse find these by invoking the command I edited above and parsing the output. By ticking the 'Allocate console in the Console View' before hitting 'Apply' it is possible to view the output of this command. These settings include include directories and defines such as __cplusplus. When these match what gcc would use when invoked through my Makefile the results are consistent.
When I was experimenting with the problem using #pragma message inside headers I thought __GXX_EXPERIMENTAL_CXX0X__ is what is wrong and saw some online suggestions for setting this manually, but that seemed to be a workaround as well.
On a fresh Eclipse install, triggering one macro and rebuilding the index solved it:
Projects->Properties->Preprocessor Includes
Select GNU C++
Select CDT User Setting entries
Press Add
and add a preprocessor macro with name __cplusplus and value 201103L.
Finally, rebuild the index.
(Project->C/C++ Index->Rebuild)
You can also remove problematic parts of code from the CDT scope by fllowing next steps:
Go to the Project Properties->C/C++ General->Preprocessor include path, Macros, etc
Select desired language on Entries tab
Add->Preprocessor macro
Enter name "MY_CODAN_MACRO" and value "1"
Now you can write:
#idndef MY_CODAN_MACRO
// this code is visible by compiler only
#else
// this code is visible by code analysis and CDT, but not visible by compiler
#endif
I think this trick is possible in Indigo+. I'm using Juno.
I realize question was asked a long time ago but since the problem persists (I user Kepler and get the same errors) I will post another possible workaround.
One can create separate source file and redefine functions he want to use there (in general namespace e.g.). After I created function like that
std::string to_string(long long num) {
return std::to_string(num);
}
and started to use to_string instead of std::to_string in main sources (I added the extra one with including) eclipse did not mark code as errors any more.
Of course the errors are marked in the extra include but it does not contain logic so you don't even look there.

vs2005 general error C10100b1(C++)

I'm ready to release my *.exe and set the release build in virtual studio 2005, but I got a error like that:
mt.exe: failed to load file "..\release\hasm.exe" {_~0 BEL SUB EOT BEL v STX
the BOLD string with 3-characters are symbol that can not print in plain text, and I can't copy them from my working conputer, but I edited them in Notepad++, and I can see them, now I typed them in "plain" text(and ther is no space(' ') between them) and I hope you can emagin their shape.
the trick is that, I can compile my debug-edition and the *.exe works well, I have tried other project and used the same encoding and there is nothing happened -- everything goes well with the debug and release.
I think there was some unicode in the code(some comments are Chinese), but the compiler should not stand along with the code, there must be a syntax error or something else. Now, it's not a syntax error or a link error, is there any other possibilities---I mean in my code? and what exactly the mt.exe doing?
ps: I have seached for all my code, there is no "{_~" in my (C++)code, FML...
My guess is that the project settings for release got broken somehow. Compare all settings between the debug and release configs. If you can't find anything, it's probably something internal in the project. The best way to fix that is to create a new project in the same solution and add all your source files to it.
Hope this helps.
Cheers,
Sebastiaan