Note: As this is a very basic question which may confuse beginners coding in CLion IDE, I’m putting this thorough answer here to stay as a step by step guide.
It seems you’ve selected C++ Executable when first creating the project. As CLion heavily depends on CMake (& thus CMakeLists.txt
), you can change the project type from a C++ Library to C++ Executable. To do this, replace the following line:
add_library(coding ${SOURCE_FILES})
with:
add_executable(coding ${SOURCE_FILES})
Afterwards, select the desired file to execute from the «Executable» combo-box in «Edit Configuration» dialogue.
Now you’re done. But if you wanna make your project clean, you may follow these steps to make it a pure executable project (rather being a library one):
- remove the
library.h
fromset(SOURCE_FILES library.cpp library.h)
inCMakeLists.txt
file. - remove the
#include "library.h"
from the beginning oflibrary.cpp
file.
Now your project seems like it was first created as a C++ Executable project.
I’m using MacOS and trying to write c++ code in Clion but when I run the simple hello world code I get the error executable is not specified
.
I’m new to Clion.
Cmakelist.txt
cmake_minimum_required(VERSION 3.2)
project(untitled)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(SOURCE_FILES main.cpp)
add_executable(untitled ${SOURCE_FILES})
asked May 6, 2015 at 19:49
7
If you have created C/C++ Library by mistake, make sure that you make a new project with C/C++ executable.
Then you will be able to debug it out of the box.
answered Jan 5, 2020 at 11:15
Vishal SinghVishal Singh
1,21114 silver badges13 bronze badges
I think CLion needs CMakeLists.txt for run/debug configuration.
More info at: https://www.jetbrains.com/clion/help/cmakelists-file.html
As a C++ newbie, I have basically created new project in CLion then copy/past CMakeLists.txt content into my project by editing required fields.
After that, I was able to configure my project for run/debug.
Default CMakeLists.txt content should be something like this:
cmake_minimum_required(VERSION 3.3)
project(YourProjectName)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(SOURCE_FILES YourSourceFile.cpp)
add_executable(YourProjectName ${SOURCE_FILES})
I hope this helps.
answered Mar 10, 2016 at 19:17
gkcgkc
4496 silver badges18 bronze badges
You just need choose target
only for you application (choose your application name).
Like this
answered Dec 10, 2016 at 7:08
whalemarewhalemare
1,0231 gold badge11 silver badges30 bronze badges
1
What I can tell from the original posts’ image is that this build config is for a «c library» project type.
Solution: create a new project of type «c executable». When you launch this project, and hit run the application does run.
While this doesn’t answer the question of whey the project type «c library» won’t execute out of the box, it will get a newbie in business of tinkering with c.
I hope this helps.
answered Nov 25, 2019 at 0:36
click the left button “+” select “generate the coffee”
alistaire
41.6k4 gold badges74 silver badges115 bronze badges
answered Mar 18, 2016 at 13:45
SnailSnail
2,7861 gold badge8 silver badges12 bronze badges
1
Comments
Undin
added
subsystem::tools
Issues about integration with external tools like rustup, cargo, rustfmt, etc.
and removed
subsystem::tools
Issues about integration with external tools like rustup, cargo, rustfmt, etc.
labels
Sep 28, 2020
ortem
added a commit
that referenced
this issue
Oct 29, 2020
Now, in case of no `perf` path specified in settings, "Perf executable path is not set" error will be shown with a link to configure the profiler settings. Fixes the corresponding issue CPP-22642 in CLion tracker
ortem
added a commit
that referenced
this issue
Nov 15, 2020
Now, in case of no `perf` path specified in settings, "Perf executable path is not set" error will be shown with a link to configure the profiler settings. Fixes the corresponding issue CPP-22642 in CLion tracker
ortem
added a commit
that referenced
this issue
Nov 23, 2020
Now, in case of no `perf` path specified in settings, "Perf executable path is not set" error will be shown with a link to configure the profiler settings
ortem
added a commit
that referenced
this issue
Nov 24, 2020
zeroeightysix
pushed a commit
to zeroeightysix/intellij-rust
that referenced
this issue
Mar 1, 2021
Now, in case of no `perf` path specified in settings, "Perf executable path is not set" error will be shown with a link to configure the profiler settings
zeroeightysix
pushed a commit
to zeroeightysix/intellij-rust
that referenced
this issue
Mar 1, 2021
Hi,
I have set up a Lab Environment using the LabDefaultTemplate.
I have created a Powershell script as a deployment script. When the Deployment Script are being run on my lab machine i recieve the following error «The specified executable is not a valid application for this OS platform.»
It doesn’t matter if use a empty ps1 file or a file that contains my deployment script. The powershell executing policy on the Lab Server is set to «Unrestricted».
Below is extract from the logfile.
Running Deployment Script
Initial Property Values
MaximumAttemptsForNetUse = 0
ScriptDetails = Virtual machine: SharePoint 2010 AgentSpec: Name=*, Tags=MachineName=SharePoint 2010,EnvironmentName=SharePoint 2010,TeamProject=Team Project 1,TeamProjectHostGroup=All Hosts FileName:
\testtfs2010bld1.MyDomain.localdropBuild all wspBuild all wsp_20101128.7Deploy.ps1 Arguments: WorkingDirectory: c:temp EnvironmentVariables: BuildLocation=\testtfs2010bld1.MyDomain.localdropBuild
all wspBuild all wsp_20101128.7 InternalComputerName_Domain Controller=WIN-U80J27DQQQN ComputerName_SharePoint 2010=VSLM-232-d9d724c4-8069-4626-8ac5-94adc974b950.MyDomain.local InternalComputerName_SharePoint 2010=WIN-92B3JTMC66T
SharedLocationForNetUse =
\testtfs2010bld1.MyDomain.localdropBuild all wspBuild all wsp_20101128.7
ThrowOnError = True
Running Script on virtual machine SharePoint 2010:
Accessing the following location using the lab service account: MyDomainsvcTFSlabservice,
\testtfs2010bld1.MyDomain.localdrop.
\testtfs2010bld1.MyDomain.localdropBuild all wspBuild all wsp_20101128.7Deploy.ps1
The specified executable is not a valid application for this OS platform.
Stopped accessing the following location using the lab service account: MyDomainsvcTFSlabservice,
\testtfs2010bld1.MyDomain.localdrop.
All servers are x64 including lab servers, TFS roles and the dev environment.
Any idea how to troubleshoot this?
Tony
-
Изменено
28 ноября 2010 г. 17:35
clarification