Category Archives: Linux

[Solved] shell Error: Syntax error: “(“ unexpected (expecting “}“)

The hard disk is damaged and the system is reinstalled. An error is reported when executing the previous script

Syntax error: “(” unexpected (expecting “}”)

Troubleshooting:

ls -l /bin/sh

The default link is dash

Knowledge supplement

Bash: Unix shell written for GNU Project

SH: equivalent to /bin/bash –posix. It is bash that opens POSIX standard

Dash: it has faster execution speed than bash, but supports fewer statement leaves

Solution:

Here, I have no requirements for the speed of script execution, only that it can be used, so I can change it to bash

cd /bin/; ln -sf bash /bin/sh

l

Problem-solving.

[Solved] SecureCRT Connect Error: The server has disconnected with an error…..

1. Problem environment
virtual machine: VMware 16
Windows system: Windows 10
linux system: CentOS 7.6
interactive software: SecureCRT 8.7
2. Prompt

3. Solution
click “options”, select “session options”, as shown in the figure below, click “SSH2”, then modify “username”, and click “OK”

4. reconnect

connect successfully

[Solved] Linux Compile Error: error: ‘for’ loop initial declarations are only allowed in C99 mode

1. Problem description

During the development of embedded Linux, compile and report the following errors

src/util/Vector.c:94:9: error: ‘for’ loop initial declarations are only allowed in C99 mode
         for (int j = V->length++; j > i; j--)
         ^
src/util/Vector.c:94:9: note: use option -std=c99 or -std=gnu99 to compile your code
src/util/Vector.c: In function ‘Vector_remove’:
src/util/Vector.c:123:9: error: ‘for’ loop initial declarations are only allowed in C99 mode
         for (int j = i; j < V->length; j++)
         ^

2. Problem analysis

GCC compilation is based on compilation lower than C99 standard. Defining variables within a for loop is not allowed in standards lower than C99.

3. Solution

Method 1

Modify code

int j;
for (j = i; j < V->length; j++)

Method 2

GCC specifies compiling using the C99 standard

gcc -std=c99

Method 3

Specify the C99 standard for compilation in makefile

CFLAGS += -std=c99

[Solved] spdlog reports an error After updating Ubuntu 22.04

After updating Ubuntu 22, spdlog and FMT report errors, mainly due to some unclear problems in the FMT library

Solution:

1. Copy the header file under include/FMT of FMT Library

to this directory

2. In spdlog/include/spdlog/fmt/bundled/core.h add a macro definition of FMT_NOEXCEPT near line 154, which is the following code

// Define FMT_USE_NOEXCEPT to make fmt use noexcept (C++11 feature).
#ifndef FMT_USE_NOEXCEPT
#  define FMT_USE_NOEXCEPT 0
#endif

#if FMT_USE_NOEXCEPT || FMT_HAS_FEATURE(cxx_noexcept) || \
    FMT_GCC_VERSION >= 408 || FMT_MSC_VER >= 1900
#  define FMT_DETECTED_NOEXCEPT noexcept
#  define FMT_HAS_CXX11_NOEXCEPT 1
#else
#  define FMT_DETECTED_NOEXCEPT throw()
#  define FMT_HAS_CXX11_NOEXCEPT 0
#endif

#ifndef FMT_NOEXCEPT
#  if FMT_EXCEPTIONS || FMT_HAS_CXX11_NOEXCEPT
#    define FMT_NOEXCEPT FMT_DETECTED_NOEXCEPT
#  else
#    define FMT_NOEXCEPT
#  endif
#endif

3. Recompile and install spdlog Library

cmake -S spdlog -B /tmp/build/
cd /tmp/build && make
sudo make install

[Solved] Linux virtual machine startup error: operating system not found

This error indicates that the boot code on the hard disk is missing

Experimental preparation steps

1) Preparation: dd if=/dev/zero of=/dev/nvme0n1 bs=446 count=1

2) Screenshot of system startup error report

The repair steps are as follows

Step 1: select boot from CD to enter rescue mode

Select the third

Select the second

Select 1) continue

Enter directly

Step 2: switch to the real root file system

chroot /mnt/sysimage

Step 3: repair the boot program

grub2-install /dev/nvme0n1

Step 4: exit twice, restart the test, and choose to start from the local disk

It has been repaired successfully

[Soled] MTPuTTY error: unable to run putty the system cannot find the specified file

Problem Description:

After moving the putty path a few days ago, an error is encountered when opening mtputty: unable to run putty. The system cannot find the specified file

It’s obviously a putty file path problem

Solution:

Upper left corner tools -> PuTTY location…

Modify the path where putty is located

So far, the connection is successful and the problem is solved.

Record problems and solve them.

[Solved] vs Error: VS_error MSB4044, the required parameter ‘RemoteTarget’ of the task ‘ValidateValidArchitecture’ was not assigned a value

vs Error: VS_error MSB4044, the required parameter ‘RemoteTarget’ of the task ‘ValidateValidArchitecture’ was not assigned a value

 

Solution: configure the item properties to ensure that the remote generation computer has only one IP address. Just don’t have anything else. Delete the redundant