Closed tcroots78 closed 6 years ago
Can you post your build.gradle with the exportedHeaders fix?
@tcroots78 did you figure this out? Without your build.gradle I can't really help.
Sorry, missed your reply somehow :? below is my code. for what it's worth, this is on OSX.
plugins {
id "cpp"
id "edu.wpi.first.GradleRIO" version "2019.0.0-alpha-3"
id "edu.wpi.first.GradleVsCode" version "0.4.1"
}
// Define my targets (RoboRIO) and artifacts (deployable files)
// This is added by GradleRIO's backing project EmbeddedTools.
deploy {
targets {
target("roborio", edu.wpi.first.gradlerio.frc.RoboRIO) {
// Team number is loaded either from the .wpilib/wpilib_preferences.json
// or from command line. If not found an exception will be thrown.
// You can use getTeamOrDefault(team) instead of getTeamNumber if you
// want to store a team number in this file.
team = getTeamNumber()
}
}
artifacts {
artifact('frcCpp', edu.wpi.first.gradlerio.frc.FRCNativeArtifact) {
targets << "roborio"
component = 'frcUserProgram'
// Debug can be overridden by command line, for use with VSCode
debug = getDebugOrDefault(false)
}
}
}
model {
components {
frcUserProgram(NativeExecutableSpec) {
targetPlatform 'roborio'
// -g is the debug information flag. You should leave this here, unless
// you have good reason to remove it.
binaries.all {
cppCompiler.args('-g')
}
sources.cpp {
source {
srcDir 'src/main/cpp'
}
exportedHeaders {
srcDir 'src/main/include'
srcDir 'src/main/cpp/Configuration'
srcDir 'src/main/cpp/Objects'
srcDir 'src/main/cpp/Objects/Mechanisms'
srcDir 'src/main/cpp/Objects/Mechanisms/CubeManipulator'
srcDir 'src/main/cpp/Services'
}
}
// Defining my dependencies. In this case, WPILib (+ friends), CTRE Toolsuite (Talon SRX)
// and NavX.
useLibrary(it, "wpilib", "ctre", "navx")
}
}
}
wrapper {
gradleVersion = '4.9'
}
Ah. In your exported headers you just need srcDir 'src/main/cpp'
for the cpp folder, not all the other ones.
doh, ok, that got rid of the build errors...coulda sworn I had that there. Do I need all the subfolders? I think in eclipse we did...
I'm still getting a few issues though:
1) IntelliSense is still giving me green squiggly lines on statements like
#include "Objects/Mechanisms/CubeManipulator/CubeManipulator.h"
should we not be doing the absolute path. This is in a this is in a .h file in the Objects folder. (i can post the zip if that would help.
2) I'm getting errors in the .o files trying to reference LightDrive.h, which is an AndyMark LED, which I think is just Issue 92
You need to run the Update C++ Configurations
vscode command to refresh those.
Eclipse did not have all the subfolders. It only had the root directory included.
For the link errors with AndyMark LED, thats going to be difficult to get working in the alpha, as we don't have an easy way to support that. And for next year it will need a recompilation.
Sounds good with the AndyMark stuff. I pinged them to see if they might have some ideas.
on the Update C++ Configuration
. I don't have that command, I disabled/reenabled C/C++ extension and that seemed to do the trick.
We have our .h files in the same folders as our .cpp files, e.g. has CubeManipulator.cpp has
include "Objects/Mechanisms/CubeManipulator/CubeManipulator.h", but gradle build is giving:
../2018_Robot/src/main/cpp/Objects/Mechanisms/CubeManipulator/CubeLift.cpp:8:64: fatal error: Objects/Mechanisms/CubeManipulator/CubeManipulator.h: No such file or directory
include "Objects/Mechanisms/CubeManipulator/CubeManipulator.h"
compilation terminated.
This seems similar to the problem described in https://github.com/wpilibsuite/vscode-wpilib/issues/57#issuecomment-410490853, but adding to grade.build -> exportedHeaders doesn't seem to fix it for me...or I'm missing something :)