LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-01-2021, 12:46 PM   #1
acollins18
LQ Newbie
 
Registered: Jun 2021
Distribution: Ubuntu
Posts: 1

Rep: Reputation: Disabled
Question New Ubuntu user, no string under cursor error in cpp file and arrow keys type ABCD instead of moving cursor


Hi, I'm brand new first day using Linux through Virtual Box and trying to follow a Youtube tutorial to make a C++ Hello World file. I opened the cpp file in a terminal using "ls" then the "vi first.cpp" commands and now I'm stuck with an error E348: No string under cursor when I try to start the header file with a #. The # won't type. Also I'm finding it frustrating that the arrows will type letters and not move the cursor, so is there a way to fix that?
I'm using Ubuntu.
 
Old 06-01-2021, 03:31 PM   #2
dmchess
Member
 
Registered: Jan 2005
Posts: 244

Rep: Reputation: 43
Just in case you didn't know. vi is a dual mode editor. To actully type code into the file, you need to be in Insert "I" or Append mode "A". For coding I like Bluefish which is a GUI editor. vi is a little bit of a monster and not for novices. People are going to shoot me, but I recommend Free Pascal, especially for novices. It performs almost as well as c and it is easier to grasp the big picture.

Terry
 
1 members found this post helpful.
Old 06-01-2021, 03:38 PM   #3
obobskivich
Member
 
Registered: Jun 2020
Posts: 596

Rep: Reputation: Disabled
Agree with dmchess - this isn't a 'linux' or 'ubuntu' issue, welcome to vi. Personally I like nano instead (and have no interest in the holy war (https://en.wikipedia.org/wiki/Editor_war)), if working from terminal, so instead of 'vi first.cpp' (which is asking the system to open the file 'first.cpp' in vi) you would run 'nano first.cpp.' Graphical IDEs, as dmchess points out, can be a nicer way to do things as well, and probably offer other functionality too.

If you want to continue on with vi, try here: https://www.howtogeek.com/102468/a-b...files-with-vi/ (I have yet to run into a system that doesn't offer nano, mind you).
 
1 members found this post helpful.
Old 06-01-2021, 03:42 PM   #4
dmchess
Member
 
Registered: Jan 2005
Posts: 244

Rep: Reputation: 43
What can I say about c descended languages. Oh the pointers, the pointers are EVERYWHERE. Arrays you need pointers, passing variables by address you need pointers and eventually a beginning programmer gets lost. Pascal has pointers too, but there they are used only for linked lists and trees and such, you really can't do those without pointers. For most business type apps in Pascal don't require the use of pointers.

Terry
 
Old 06-01-2021, 03:50 PM   #5
dmchess
Member
 
Registered: Jan 2005
Posts: 244

Rep: Reputation: 43
Oh I kinda like vi. I forced myself to learn it while coding some awk on a hp tandem unit. Oh My what a beast. It doesn't have vim, but the old vi. I then forced myself to code some basic Pascal programs using vim. Vim is a lot nicer and now I can use it, but I am no vim expert, I just get by.

Terry
 
Old 06-02-2021, 12:32 AM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,365

Rep: Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753
It's extremely likely 'vi' has been symlinked to vim (vi improved).
You can google vimtutor and try that - it teaches you how to use vi/vim.

There's a natty little visual tutor here https://www.openvim.com/.

It's (vi / vim) pretty much guaranteed to be installed as default on almost any variety of *nix, so it's well worth learning the basics just in case.

Personally I always use vi/vim, otoh you don't need to know much to be able to work well with it.
Once you get used to it having 2 modes (command or insert/append) you're good to go.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Ubuntu 12.04 computer's arrow keys, page-up and page-down keys suddenly freeze julianvb Linux - Software 7 06-20-2014 06:33 AM
Putty, SSH, Arrow Keys Produce Character String Instead Of Working As Expected newOperator Debian 4 12-21-2011 10:45 AM
&abcd& - directory tostay2003 Programming 3 08-07-2008 01:01 AM
Shift-arrow and Alt-arrow keys don't work in xterm Aviv Hurvitz Linux - General 2 09-30-2006 03:43 PM
Arrow keys dont work in JAVA under GNOME budhusa Linux - Hardware 1 02-08-2004 11:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration