I just started using the Code::Blocks editor for Fortran because a friend suggested it. I can't get the source formatter to work properly. For this simple code segment:
print *,'hello moon'
!left = (mybankact-tax) * number1
!iowe = stuff-1;
I get this, when I use "Format using AStyle"
print *,'hello moon'
!left = (mybankact-tax) * number1
!iowe = stuff-1;
I get these strange indents all the way down my code. Anyone know how to get this to work? This is driving me nuts. (Or other good editors for Fortran - I don't need to compile code, just edit and jump between functions, which code::blocks is great for.)
By the way, the file extension is ".90" and all the syntax highlighting works fine, so code::blocks seems to recognize this is Fortran okay.
Related
I'd like to embed R into a c++ winforms app. It will output the graphs to a pictureBox, and output the numbers to a richTextBox. It takes commands from a textbox. I tried the header file RInside.h, but there is no such file.
Pseudo code:
#include <someDirToImbedR>
ExecuteButton_Click(args) {
RExecute(commandTextBox->Text);
outputGraphPictureBox->Load(output_graph);
richTextBox1->Text = OutputString;
}
I found this post on SO concerning (may be) the same problem.
Here is the Link to a repository by Dirk Eddelbuettel. It has even sample code in c++ to try for yourself.
Also this Link might be helpful.
Hope this can bring you on track. Unfortunately I personally used R only in C#.
So i wanted to ask how to get "proper" Code Completion working for CodeBlocks 13.12 for c++, im running mint rosa at the moment.
By this i mean
string buf;
buf. <--This doesnt work - no suggestions
I would like the "." to show me relevant function/attribute names. It autocompletes variables and shows relevant type information, but nothing of the type mentioned above that originates from a library.
For example I see that this works for some cases
MyClass obj;
obj. <--This works
My aunt gave me a book about c++ (for beginners). It's nice and so I wanted to test one of those code samples. But I am just getting errors. I didn't find anything that could help me on Google or so.
I am using Eclipse Mars.1 C++ and MinGW.
Code:
/*
* Erstes_Programm.cpp
*
* Created on: 26.12.2015
* Author: Luca
*/
// Erstes Programm
#include <iostream>
using namespace std;
int main() {
cout << "It's just a test!" << endl;
return 0;
}
I am getting those errors:
Using namespace:
Description Resource Path Location Type
expected ';' before ':' token
Erstes_Programm.cpp /Programmieren C++ (Einführung)
line 10
C/C++ Problem
AND
Description Resource Path Location Type
expected unqualified-id before ':' token
Erstes_Programm.cpp /Programmieren C++ (Einführung)
line 10
C/C++ Problem
Hope somebody can help me?
Here is a screenshot:
EDIT: PROBLEM SOLVED!! I don't know WHAT I did, but it's solved I'm not getting any errors and everything works perfectly. Thanks for everybody who wanted to help
The first line in the screenshot doesn't make any sense. Remove it. The rest looks fine. And in the future, post text, not screenshots.
Instead work on X-code rather then eclipse for C++. Visual studio is most recommend.
For Your problem, I think you got to play with the library, something must not be supported, other then that your code look fine.
I got a project from MS VS, and at the moment I'm migrating it to compile using gcc for Windows.
The C code is completely ported, but I'm having a problem using windres to compile the projet resources.
I'm having a syntax error, reported by windres, at those single lines:
CONTROL "Tab1",IDC_FILETAB,"SysTabControl32",TCS_BOTTOM,0,1,336,194
CONTROL "Tab1",IDC_KEYS,"SysTabControl32",TCS_BOTTOM,27,111,73,6
All others use of Control, with similar syntax, works as expected...
According with http://cygwin.com/cygwin-ug-net/windres.html , the follow syntax is used for CONTROL:
CONTROL ["name",] id, class, style, x,y,w,h [,exstyle] [data]
CONTROL ["name",] id, class, style, x,y,w,h, exstyle, helpid [data]
At top of resource.rc I'm including afxres.h,winuser.h and windows.h .
Can any one give me a help? I don't have a clue about what to do....
BTW, if I comment those lines, all ends with no errors, but the executable cannot works properly.
Thanks
Edit: After more search on the internet.. I found that windres already had many problems with syntax accepted on windows resource compiler, mainly because some classes aren't visible for windres. So if any one know an alternative classes/id, or where it are defined to include, I can workaround it.
You might have copied the code happens all the time just open the code in a textviewer and change the format to plain text or edit and replace characters like " , ' etc.
I'm new to coding C++ programs in Visual Studio. When I am coding C# programs in VS, code formatter changes code that looked like this
for(int i= 0; i<(n+ m) ; i++){
}
into
for(int i = 0; i < (n + m); i++)
{
}
which is way easier to read. When I write the same thing in C++, nothing happens. I tried to select the text and press Ctrl+E, F, but that didn't work. Is there a way to improve the C++ code formatter in visual studio?
Visual Studio can't format C++-Code. Maybe there is a VS extension. I searched a long time, but never found a suitable one for free.
A very good, free, but not easy to use code formatter is GreatCode. Its a command line tool.
You can configure it as "External Tool":
After unpacking GreatCode on your HD just go Tools->External Tools->Add and insert the following settings...
Whenever you call that Tool, the actual opened file is being formatted.
You can configure GreatCode as you like in the gc.cfg. I tried many options, some are easy, some are complex.
If you want a Microsoft-like looking, just use my settings as a template and fine tune yourself:
-code_constructor_style-1
-code_split_fctdef_style-5
-code_split_decl_style-2
-overwrite_read_only-
-verbose-
-tab_out-
-space_if-
-space_return-
-space_fctcall_inparam-
-no-space_fctcall_firstparam-
-no-space_cast_after-
-space_affect_style-0
-space_autoaffect_style-0
-code_len-180
-code_keep_more_empty_lines-
-code_decl_access_to_type-
-code_decl_break_template-
-code_remove_return_paren-
-code_align_max_blanks-80
-code_class_access_eol_after-1
-code_class_access_eol_before-1
-code_split_fctcall_style-1
-code_constructor_style-1
-no-code_split_bool_before-
-no-stmt_concat_else_if-
-no-stmt_decl_remove_empty-
-no-stmt_concat_if_remove_empty-
-no-stmt_concat_else_if-
-stmt_force_brace-1
-stmt_break_dowhile-
-stmt_switch_style-1
-stmt_switch_eol-0
-stmt_class_indent-0
-stmt_static_init_style-2
-stmt_concat_inline_class-
-pp_align_to_code-
-pp_style-1
-pp_align_breakline-
-no-cmt_first_space_cpp-
-cmt_dont_modify-
-no-cmt_add_class_access-
-no-cmt_add_gc_tag-
-no-cmt_add_fct_def_class-
-no-cmt_decl_before-
-no-cmt_decl-
-no-cmt_first_line_break_first-
-no-cmt_first_line_break_last-
-no-code_split_bool_before-
-catch_eol_before-1
-no-stmt_decl_remove_empty-
-no-cmt_add_fct_def_class-
-no-cmt_add_class_access-
-no-stmt_break_alone-
-stmt_concat_inline_class-
-cmt_keep_cpp-
Good luck!
I use exactly the same approach as DirkMausF except the formatting tool itself. I would suggest you to use Artistic Style formatter:
http://astyle.sourceforge.net/
It is well documented and comes with a lot of predefined formatting styles so it is very easy to use.
If you have cash to spend, you might want to look in to Visual Assist. See also, this question.
For a long time, I was writing all the C++ code in Netbeans and I was compiling it in Visual Studio. Netbeans is formatting code perfectly (with ALT+SHIFT+F) and there are many formatting options.