小编Spy*_*iam的帖子

使用 Clang 为 RISC-V 进行编译

我正在尝试使用 RISC-V 架构(版本 12.0.1)构建一个 hello world 程序Clang。我已经使用LLVM(版本 12.0.1)安装了它,设置如下:

cmake -G "Unix Makefiles" \
   -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;libcxx;libcxxabi;libunwind;lldb;compiler-rt;lld;polly;debuginfo-tests" \
   -DCMAKE_BUILD_TYPE=Debug \
   -DLLVM_ENABLE_ASSERTIONS=On \
   ../llvm
Run Code Online (Sandbox Code Playgroud)

根据here,默认LLVM_TARGETS_TO_BUILDLLVM_ALL_TARGETS,其中包括RISC-V。

所以我尝试编译它,clang --target=riscv64 -march=rv64gc hello_world.c -o hello_world但收到错误:

hello_world.c:1:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
         ^~~~~~~~~
1 error generated.
Run Code Online (Sandbox Code Playgroud)

同时,/opt/risv/我安装的riscv-gnu-toolchain, 位于我的路径中,我可以riscv64-unknown-linux-gnu-gcc hello_world.c -o hello_world毫无问题地运行。

我正在使用 kernel 的 Ubuntu 机器上尝试5.8.0-63-generic

知道如何解决这个问题并能够通过 Clang 编译 RISC-V 程序吗?

compilation llvm clang riscv

4
推荐指数
1
解决办法
1万
查看次数

如何渲染ap:panel,从选择ap:selectonemenu触发?

我正在使用Primefaces 3.4和JSF 2.1,我试图让ap:panel项目出现并消除选择p:oneselectmenu.我有一个p:datatable面板,我想要出现并动态填充,这就是我使用面板的原因.数据表的功能很好,但是面板没有.我尝试将面板上的"呈现"选项与一个变量相关联,该变量随着菜单的每个选择的变化而变化,但没有发生任何事情.我也尝试过,p:outputpanel但没有发生任何事情.所以我尝试使用具有相同操作的按钮但又失败了.这是我的代码:

<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:p="http://primefaces.org/ui"
  xmlns:f="http://java.sun.com/jsf/core">
<h:body>
    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            #{msg.teaching}: #{msg.socialSecurity}
        </ui:define>
        <ui:define name="body">
            <h:form id="form">
                <p:messages id="messages" autoUpdate="true"/>                  
                <p:panel id="selectSocialSecurityPanel" rendered="true">
                    <p:panelGrid>
                        <p:row>
                            <p:column>
                                <p:selectOneMenu value="#{selectOneMenuSocialSecurityTeachingBean.choice}">
                                    <p:ajax update="socialSecurityDataTablePanel, socialSecurityDataTable, toUpdate" listener="#{dataTableSocialSecurityBean.updateTable()}"/>
                                    <f:selectItem itemLabel="#{msg.select}" itemValue=""/>
                                    <f:selectItems value="#{selectOneMenuSocialSecurityTeachingBean.socialSecurityTeachingList}"/>
                                </p:selectOneMenu>
                            </p:column>
                            <p:column>
                                <p:commandButton value="#{msg.find}" actionListener="#{dataTableSocialSecurityBean.updateTable()}" update="socialSecurityDataTablePanel, socialSecurityDataTable, toUpdate" id="button">
                                    <f:ajax render="toUpdate"/>
                                </p:commandButton>
                            </p:column>
                        </p:row>
                    </p:panelGrid>
                </p:panel>                    
                <p:outputPanel id="toUpdate" rendered="#{dataTableSocialSecurityBean.rendered}" autoUpdate="true">
                    <p:panel id="socialSecurityDataTablePanel">
                        <p:dataTable id="socialSecurityDataTable" var="unit" value="#{dataTableSocialSecurityBean.socialSecurityList}">                    
                            <p:columns value="#{dataTableSocialSecurityBean.columns}" var="column" columnIndexVar="colIndex">
                                <f:facet …
Run Code Online (Sandbox Code Playgroud)

jsf panel selectonemenu primefaces

2
推荐指数
1
解决办法
8816
查看次数

核心转储在C程序中

我对C编程很老了(尽管我已经多年没有用C语言编程了)但我现在完全陷入困境.我有两个源文件:

main.c中

#include <stdio.h>
#include "inputFunction.h"

int main(int argc, char** argv) {
    char *invoiceFile=NULL, *inputFile=NULL, *configFile=NULL;
    getInput(argc, argv, &invoiceFile, &inputFile, &configFile);
    if(invoiceFile!=NULL){
        free(invoiceFile);
    }
    if(inputFile!=NULL){
        free(inputFile);
    }
    if(configFile!=NULL){
        free(configFile);
    }
    return (EXIT_SUCCESS);
}
Run Code Online (Sandbox Code Playgroud)

和inputFunction.c

#include "inputFunction.h"

int getInput(int argc, char** argv, char **invoiceFile, char **inputFile, char **configFile) {
    int i;
    if (argc != 3 && argc != 5 && argc != 7) {
        inputError();
        return 1;
    } else {
        for (i = 1; i < argc; i += 2) { …
Run Code Online (Sandbox Code Playgroud)

c valgrind coredump memory-leaks

2
推荐指数
1
解决办法
1652
查看次数

带有参数C ++的对象数组的初始化列表

在C ++中,我试图在构造函数中初始化一个对象数组,这些对象的构造函数采用一个或多个参数。我想在构造函数的初始化列表而不是它的主体上执行此操作。这有可能吗?

我的意思是:

class A{
  public:
    A(int a){do something};
}

class B{
  private:
    A myA[N];
  public:
    B(int R): ???? {do something};
}
Run Code Online (Sandbox Code Playgroud)

我应该放什么??? 用参数R初始化数组myA?

c++ arrays constructor initialization list

2
推荐指数
1
解决办法
1041
查看次数

如何从Netbeans上的另一个包打开属性文件(JAVA)

我有一个bean需要从属性文件中获取一些参数但我找不到它(java.lang.NullPointerException)才能打开它.我的bean在extra.beans包中,而属性文件在extra.dao包中.我想做

file = new FileInputStream("database.properties");
prop.load(file);
Run Code Online (Sandbox Code Playgroud)

我已尝试任何可能的组合路径,但我找不到它.我正在使用Netbeans 7.4.我该怎么打开它?

java netbeans nullpointerexception fileinputstream

1
推荐指数
1
解决办法
1475
查看次数