I want to change constexpr-ops-limit to a bigger number. I know that it is possible with -fconstexpr-ops-limit= as a command line argument, but I have no possibility to change arguments because I submit my code to a system that runs it automatically. I wonder if there are any pragmas in GCC or VC++ that will match my needs.
Is there any way to do it? Thank you in advance.
Related
I'm trying to pass arguments to my Xcode C++ command-line tool. I think I'm following the help, and the answers I've found on Stack Overflow, but I'm not having any luck.
I'm using Xcode 7.2.1. I've edited the scheme to have two command-line arguments (an input file and an output file.) I've posted a screen shot of the editor below.
When I run the code, it doesn't find the arguments. (I don't mean that it can't find the files on disk. The program aborts because argc is 1 instead of 3.)
Can you tell me what I'm doing wrong?
EDIT: After playing around with it in response to the advice I received, it suddenly worked. I have no idea what changed. It works now with the dialog looking exactly like the screenshot I posted originally.
I'd suggest that you use only one argument set at a time. Each one of the checked lines represents a command line, not a single argument, so put both of your arguments on a single line, as in
$PROJECT_DIR/detroit.txt $PROJECT_DIR/detroit.out
I am trying to grab the addresses that associated with the start of the source code and the one at the end. I tried to do it using LLVM, Clang but I could not.
Is there a way to get the memory addresses that associated of each line in the source code?
Thanks
There are several possibilities:
You can use debug information for this. Note, however, that this
information might not be precise for optimized code
Alternatively,
you can use special linker script which will insert two symbols
before and after all the code in the code section.
Duplicate : The program arguments text box in codeblocks 10.05 is not visible
I want to debug code which takes command line arguments in C++ using Codeblock IDE.I googled and read that "Project-> Set program's aregumnets" can be use to pass the command line arguments. But when I choose that option the textbox is not editable. Please refer the snapshot below for your kind reference.
Any thoughts on on how to fix this.
Edit:
I am on Ubuntu.
I am able to tab in Program arguments but unable to increase the size of text box.Even maximising the window is not doing any help. I can see that I am able to type.
Reinstalling did not help.
I found this link
http://ubuntuforums.org/showthread.php?t=1906791
which talks about hacking "I can work round by hacking the project.cbp file and adding a line but this is messy."
Can someone please elaborate how this workaround might work for me. Thanks.
I find the solution here I don't know how to use Project->Set programs' arguments to provide arguments to.
Basically, what you need to do is to substitute select_target.xrc file in /usr/share/codeblocks/manager_resources.zip with the one in the attached file select_target.zip. The attached file can be only available when you log on the forum.
I am trying to insert a custom preprocessor into the VC++ 2010 build-pipe after the regular preprocessor has finished, so far i figured that the way of doing this is via MSBuild.
To this point I wasn't able to find out much more, so my questions are:
Is this possible at all?
If so, what do I need to look at, to get going.
If you are talking about the c/c++ preprocessor, then you are probably out of luck. AFAIK, the preprocessor is built into the compiler itself. You can get the compiler to output a pre-processed file and then you MIGHT be able to send that through the compiler a second time to get the final output.
This may not work anyway due to the code being produced, at least in previous versions of cl.exe, doesn't seem to be 100% correct (white space gets mangled slightly which can cause errors).
If you want to take this path, what you'd need to do is have an MSBuild 'Target' that runs before the 'ClCompile' target.
This new target would have to run the 'cl.exe' program with all the settings that 'ClCompile' usually sends it with as well as the '/P' option which will "preprocess to a file".
Then you need to run your tool over the processed file and then finally feed these new files into 'ClCompile'.
If you need any more info just reply in the comments and I'll try to add some when I get the time (this question is rather old, so i'm not sure if it's worthwhile investing more time into this answer).
How do you pass options to an executable? Is there an easier way than making the options boolean arguments?
EDIT: The last two answers have suggested using arguments. I know I can code a workable solution like that, but I'd rather have them be options.
EDIT2: Per requests for clarification, I'll use this simple example:
It's fairly easy to handle arguments because they automatically get parsed into an array.
./printfile file.txt 1000
If I want to know what the name of the file the user wants to print, I access it via argv[1].
Now about how this situation:
./printfile file.txt 1000 --nolinebreaks
The user wants to print the file with no line breaks. This is not required for the program to be able to run (as the filename and number of lines to print are), but the user has the option of using if if s/he would like. Now I could do this using:
./printfile file.txt 1000 true
The usage prompt would inform the user that the third argument is used to determine whether to print the file with line breaks or not. However, this seems rather clumsy.
Command-line arguments is the way to go. You may want to consider using Boost.ProgramOptions to simplify this task.
You seem to think that there is some fundamental difference between "options" that start with "--" and "arguments" that don't. The only difference is in how you parse them.
It might be worth your time to look at GNU's getopt()/getopt_long() option parser. It supports passing arguments with options such as --number-of-line-breaks 47.
I use two methods for passing information:
1/ The use of command line arguments, which are made easier to handle with specific libraries such as getargs.
2/ As environment variables, using getenv.
Pax has the right idea here.
If you need more thorough two-way communication, open the process with pipes and send stuff to stdin/listen on stdout.
You can also use Window's PostMessage() function. This is very handy if the executable you want to send the options to is already running. I can post some example code if you are interested in this technique.
The question isn't blazingly clear as to the context and just what you are trying to do - you mean running an executable from within a C++ program? There are several standard C library functions with names like execl(), execv(), execve(), ... that take the options as strings or pointer to an array of strings. There's also system() which takes a string containing whatever you'd be typing at a bash prompt, options and all.
I like the popt library. It is C, but works fine from C++ as well.
It doesn't appear to be cross-platform though. I found that out when I had to hack out my own API-compatible version of it for a Windows port of some Linux software.
You can put options in a .ini file and use the GetPrivateProfileXXX API's to create a class that can read the type of program options you're looking for from the .ini.
You can also create an interactive shell for your app to change certain settings real-time.
EDIT:
From your edits, can't you just parse each option looking for special keywords associated with that option that are "optional"?