kdevelop no valid executable specified - c++

I've just installed kdevelop 4.1 , then created a normal hello world , build is ok but when i press execute it gives me (no valid executable specified) any idea ?

Meh, the launch configuration - our biggest usability problem...
Go to Run -> Configure Launches
select your project to the left
hit the "+" button
to the right, select your project target
optionally add a build dependency (again, select e.g. your target).
that should be it.
/me really wants to rewrite this dialog...

After following the steps provided by milianw. In case it doesn't work, follow this steps:
Go to Run >> Current Launch Configuration
choose the current file name you are trying to compile.

Related

Compile and execute cpp in xcode, and add additional execution instructions, Such as iconv command

Sorry, I'm new to Xcode and not very familiar with it, I use Xcode (command line tool project with external build system) to compile cpp files and automatically execute cpp unix executable files. After the program is compiled (command+R), I set the settings as shown in the screenshot below to automatically execute. Is there any way for me to execute also add additional commands?
Such as iconv.
The following line is what I ultimately want to execute.
./myFile argument1 | iconv -f big5
But my Xcode looks like it's executing only
./myFile argument1
really thanks
On the same place where you setup the build scheme, you can also add a post-build script.
Go to the left of the panel, and expand Build
Select Post-actions
Near the bottom center, click on + -> New Run Script Action
Add script like you would run them in terminal
Note the current directory will not be where the project is built
You can use ${TARGET_BUILD_DIR} macro for the build directory
Note, you want to make sure to select your current project at the Provide build settings from so it can import the correct path macros like TARGET_BUILD_DIR
A screenshot of adding a post-build script:
*Older versions of Xcode might have different GUI, but the idea should be about the same.
Sidenote, ⌘R is really for running the program within Xcode, consider using ⌘B.

VisualStudio 2017 multiple "Keep Target Branch Version"

After some changes I've to merge the master branch in a dev branch where we deleted tons of files, so the "Resolve Conflicts" page lists all of them and it seems I should process each and every conflict choosing "Keep Target Branch Version". Since they are around 4k of them, is there any way to select all the conflicts I want to be kept from the target branch and resolve them with few clicks? FYI the code is on VSTS. My only alternative I think is could be to delete the 4k files in the master (source) branch as well and then merge into the dev (target) one.
Thanks in advance
You can try below ways to achieve that:
Select all (select the first item, hold Shift and select the last item.) then click "Keep Target Branch Version".
Another way is using the Resolve Command:
tf resolve ..... /auto:TakeTheirs will "Take Source Branch Version." My suggestion is to do the resolve, then check your branch
and make sure that you have what you expect before you check in.
tf resolve .... /auto:KeepYours will "Keep Target Branch Version"
Following below steps to do that:
Merger from one branch to another from Visual Studio (Conflicts
appear)
Open cmd console Developer Command Prompt for VS2017
cd to workspace location
Run below command (It will prompt the dialog to enter your credential to login VSTS):
tf resolve /auto:KeepYours

Add multiple independent main() programs in one project - XCode

I've very big problems with XCode. First of all, I want to tell you that my starting language was Java. In Java you can write multiple programs in one project, which is very useful for smaller programs, f.e. Hello World.
Now I want to learn C++ and write some programs for exercise. I already wrote one in my project "Uebung" (= Exercise). Now I want to write another program, which is completely independent of my previous program, but it's still an exercise program, so I want it in my "Uebung" project.
I've researched and found out that targets are my solution. Unfortunately, I can't figure it out how to configure them properly.
You can see the build Phase of my program "NumberCounter". Look at the bottom right corner, there you'll see that it works:
Now I want in my Project "Uebung" and in the Folder "Uebung" a new program with a main.
I go to File -> New -> Target -> Command Line Tool and choose a name for my new target.
Now a new folder pops out with the same name as my target. Note that the target is red and I don't know why. The Compile Source is the new main in the folder "test":
Now I want to compile "Test", it should just print "Hello, World!", but it doesn't as you can see. It compiles my "NumberCounter" program:
So I thought, maybe my order was incorrect. I delete my new target and the folder "test" with the main in it. Now it looks exactly like in the beginning.
I create a new C++ File "test" and now I can choose a target. I'll uncheck my "Uebung" target, because this isn't the one I want:
Now It looks like this and this is exactly how I want it:
Same Procedure: I go to File -> New -> Target -> Command Line Tool and choose a name.
Again, a new folder pops out but this time it is red.
This is how my build phase looks like:
This isn't how I intend it to be so I change it to this:
Since I don't need the "test" folder I simply delete it.
I wrote down some code in my new program and compile it, but again it runs the wrong program:
.
I hope there's somebody who can help me.
Thank you very much!
Everything you did the first time to add the 2nd target test was correct.
Your issue is that once you have two or more targets, you need to choose which target is the active target. Look at the titlebar at the top of the Xcode window. See the Play and Stop icons? To the right of those it says "Uebung" followed by "My Mac". Click on "Uebung" and select "test".
Now your "test" target is active. You can now build and run that target.
FYI - "test" appears red under Products because you have not yet built that target.

Changing output directory in VS2010 project doesn't work

I have combined several projects into one solution. I created empty solution and added these projects and here is a blue print of how it looks like:
Root:
Project1 - directory
Project2 - directory
Debug - directory
Main.sln - file
Now I want to direct the executable and dll from both projects to \debug folder shown up of the solution file. I go into project properites >> Configuration Properities >> General >> 'Output Directory' and change the output directory to $(SolutionDir)$(Configuration)\ which is default for a new project.
The problem is that it has no effect on where the output file is created, it is still created in the old destination. The old path for `Output Directory' was .\Debug\ not that it matters.
Could this be because the SolutionDir & Configuration may not be defined? Where can I see their definition or values? I also want to create a new configuration which would be 'Release with Debug' how can I create that using environment variable? Thanks!
My project is MFC/Visual C++.
Add-on:
Where are these identifiers like SolutionDir defined in the scrip? I look up for in .vcxproj file but there is mention of it. I create a new dummy VS2010 project just to look at it's .vcxproj file but these project settings identified are not defined in any place that I can see!
This is most likely caused by specific settings overriding global settings, namely Linker's "output" setting. This happens often as a result of conversion from earlier Visual Studio.
What you need is to go through every setting, paying attention to those whose values are written in bold, and reset to default (select it from dropdown) every setting with 'debug' or 'release', and others as necessary.
There could also be specific settings on files. I usually resolve this by opening project in notepad and removing any excessive settings. Just be careful. Using multiline replace in Notepad++ or any other capable editor helps.
I think I had a similar problem.
What I ended up doing was editing the vcxproj file directly. Find this section and edit it like this for each of your configurations:
<PropertyGroup>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
</PropertyGroup>
I had a similar problem with the Intermediate Directory setting in one of my VS2010 projects. No matter what I set it to, it would always use the default value of $(SolutionDir)$Configuration. Oddly, other projects in the same solution with the same settings worked just fine.
After playing around, I stumbled upon a solution.
Click on the setting in the propery page dialog.
Click on the down arrow button in the right-hand side of the edit box.
Select "inherit from parent or project defaults".
Click "Apply".
Click on the setting and change it to your desired value.
I don't know why this works, but it does. It seems like the macros were not being properly evaluated for whatever reason. Then, after you apply the inherited values, it seems to reset itself and start evaluating the macros properly.

Where to start for writing a shell script for copying elements into main app xcode4

I am looking for some documentation or tutorial for copying files from a given directory into the app created by xcode at build time, before it is run.
At first I have tried to copy files into the derived directory, hoping that everything resides in there would be automatically added to the app, but I was wrong.
So I am looking for a script because the original dir may change its name, second the script could be customized by another xcode 4 user with its src dir path etc.
The things is I don't know how to start, which language etc. I am quite confident with shell script, but maybe there's a better option.
Second, I am trying to figure out which command could add a file in the already built app.
thanks
That answer didn't really help - the BUILT_PRODUCT_DIR isn't where most stuff goes.
Ultimately, I found you just need to do:
Add the following to the very end of your script (or get your script to write directly to the output location):
cp ${DERIVED_FILE_DIR}/[YOUR OUTPUT FILES] ${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}
...but there's a lot of other things I tried. More thoughts and ideas here: http://red-glasses.com/index.php/tutorials/xcode4-a-script-that-creates-adds-files-to-your-project/
You want a Run Script or Copy Files build phase. Select your main project in the navigator, then select the app's target. Click the Build Phases tab. Click the Add Build Phase button at the bottom of the window and choose the appropriate phase.
By "appropriate" I mean if you really want to run a script, you'll use a Run Script build phase and use Xcode-provided environment variables like $BUILT_PRODUCT_DIR (see the documentation or hit build and examine the full output of an empty script in the build log) to figure out your target folder. If all you want to do is copy files (no real processing), the Copy Files build phase already knows how to locate the app bundle's proper folders depending on what you're copying (Resources, Frameworks, etc.).