#include <cerrno> does not find it

Working from Pros in Visual Studio. MAIN.CPP as supplied. Did my first build of it , but received error for #include “main.h” : in included file cerrno file not found. (api.h ln 23, col 10)

I created an initial project in a separate folder in the root directory, and found main.cpp in src. I had to add api.h and main.h into that src directory.

It is as if I need a PATH statement, environment variable, or a config file to direct the compiler to the include folder?

Could you change your catagorie from vexcode to pros support?

Is cerrno the only file it cannot find? It seems a little strange that it would be able to find cmath, cstdio, etc. but not cerrno. Can you run the command pros build-compile-commands in the integrated terminal and send the output?

I had to add api.h and main.h into that src directory.

You do not need to do this… if the compiler could not find api.h inside of the include folder, how would it find all of the other header files in /include? We should focus on identifying why cerrno can’t be found instead of changing the project structure.

It is as if I need a PATH statement, environment variable, or a config file

This is all done automatically within VSCode. If you want to add the environment variables to be used outside of VSCode you can read this: Vscode PROS executable location · Issue #192 · purduesigbots/pros-cli · GitHub

2 Likes

The problem is more basic. There is no cerrno nor cmath etc on my system.
I thought I would need to install some SDK or something to get those header files.
I also find a problem that the “toolchain” could not be found:
%appdata%\Code\User\globalStorage\sigbots.pros\install\pros-toolchain-windows\usr\

It appears that my installation is not complete. Here is what is there:
C/C++ Intellisense
C/C++ Extension Pack
C/C++ Themes
Clangd
CMake
Cmake Tools
PROS
Better C++ Syntax

I am running low on disk space, and I am concerned that the CRT SDK is going to blow it.

So what is the minimun set of pre-requisites required to build and upload?

The minimum pre-requisites to my knowledge are the PROS cli and PROS toolchain. Installing both will take up about 1GB of storage. Currently, the VSCode extension will also force install the clangd extension, but I’m not sure how much space that takes up.

Since you were able to create a pros project (either through the sidebar button or the pros c n command), I will assume that the CLI installation was successful.
If the PROS extension installed the CLI but not the toolchain, doing the following should fix it:
In VSCode, press ctrl + shift + P → Preferences: Open User SettingsExtensionsPROS, then set One Click: Toolchain Download URL to https://github.com/purduesigbots/toolchain/releases/download/v10.3-2021.07/pros-toolchain-windows.zip. Then, click “Install PROS” in the PROS sidebar. The download may take a while.

Edit: The url above will only work on windows, so don’t try it if you are on mac or linux.

3 Likes

yes, I keep forgetting to ask you all (the PROS team) to disable that, it stops use of alternate language servers.

4 Likes

Windows 10.
Thanks., I did uninstall PROS, then install. Pros install succeeded. Then downloading toolchain. CLI and Toolchain installed successfully. Verify PROS Installation reports “CLI and Toolchain are working”

Build of main.cpp from my project src folder results in 21 errors, first being
In included file ‘cerno’ not found.
api.h [ln 23 col 10] which is #include cerrno

I can now locate such a file in
C:\Users\USER\AppData\Roaming\Code\User\globalStorage\sigbots.pros\install\pros-toolchain-windows\usr\arm-none-eabi\include\c++\10.3.1

and errno.h in
C:\Users\USER\AppData\Roaming\Code\User\globalStorage\sigbots.pros\install\pros-toolchain-windows\usr\arm-none-eabi\include\sys

The build process is not finding them.

So I once again downloaded pros-windows-3.3.3.0-64bit.exe from github purdue site. Releases · purduesigbots/pros-cli · GitHub
When I opened it to install, there were a few options to select, one of which referred to the toolchain path, which was not ticked by default. Before I could select it, up came the “Accept Ts & Cs” screen. Upon accepting that, the installation proceeded before I could make those installation selections.

Therefore I cancelled it, and tried again, adding in the Toolchain option. I received a warning that I was running short of disk space. I deleted some large files, the install then continued to completion.

I note some additions to the PATH environment varilble, …\PROS\toolchain\usr\bin

Tried again -
cerrno not found, then for api.h [ln 23, Col 10] Use of undeclared identifier ‘pros’
then for ‘LCD_BTN_LEFT’ etc
21 error diagnostics

Just to confirm, these errors occur when you run pros build-compile-commands in the PROS integrated terminal (Click “Integrated Terminal” in the PROS Sidebar), not the problems tab that VSCode offers, right? VSCode is not great when it comes to figuring out include errors, and I’m not sure what the issue with the toolchain could be.

2 Likes

I was doing “Open file” then “build” from the PROS sidebar.

If I go to the terminal CLI mode:

PS C:\temp\src> pros build main.cpp

WARNING - pros.ga.analytics:send - Unable to send analytics. Do you have a stable internet connection?
make: *** No rule to make target ‘main.cpp’. Stop.
ERROR - pros.cli.build:make - Failed to make project: Exit Code 2
Error: Failed to build
Sentry is attempting to send 1 pending error messages
Waiting up to 2 seconds
Press Ctrl-Break to quit
PS C:\temp\src> ls

Directory: C:\temp\src

Mode LastWriteTime Length Name


d----- 6/08/2022 8:24 AM .vscode
-a---- 3/08/2022 5:36 PM 1926 api.h
-a---- 6/08/2022 11:30 AM 3020 main.cpp
-a---- 3/08/2022 5:36 PM 2170 main.h

  1. You need internet to create a PROS project, so I hope that you created your project while you had an internet connection.
  2. dont open just main.cpp in VSCode, open the entire project folder.
  3. when building from the cli, don’t target main.cpp. Just do pros build-compile-commands so it builds the entire project, and generates the compile_commands.json file to improve the VSCode Problems tab.
4 Likes

Thanks for all the help. I uninstalled PROS, re-installed, Performed Create Project, gave it a name, and this time it created all the required files
DIR .cache
DIR .d
135 .gitignore
DIR .vscode
DIR bin
10,449 common.mk
2,250 compile_commands.json
DIR firmware
DIR include
1,576 Makefile
18,381 project.pros
DIR src

Now, main.cpp compiles with no errors, and I am happy. It would seem that previous installs of PROS and toolchain did not complete successfully.

Since this was my first attempt, I did not know what to expect.