我正在尝试使用netcdf库和g ++静态链接一个非常简单的程序。该程序如下所示:
#include "netcdf.h"
int main(void)
{
int ncid, ok;
ok=nc_create("testing.nc", NC_NOCLOBBER, &ncid);
ok=nc_close(ncid);
return(0);
}
Run Code Online (Sandbox Code Playgroud)
如果我像这样编译它,效果很好:
> g++ test.cpp -lnetcdf
Run Code Online (Sandbox Code Playgroud)
但是,如果我尝试静态编译它,那么一切都会中断:
> g++ -static test.cpp -lnetcdf
/usr/lib64/libnetcdf.a(nc4file.o): In function `sync_netcdf4_file':
(.text+0x5a): undefined reference to `H5Fflush'
/usr/lib64/libnetcdf.a(nc4file.o): In function `close_netcdf4_file':
(.text+0x11b): undefined reference to `H5Fclose'
/usr/lib64/libnetcdf.a(nc4file.o): In function `get_netcdf_type':
(.text+0x18b): undefined reference to `H5Tget_class'
/usr/lib64/libnetcdf.a(nc4file.o): In function `get_netcdf_type':
(.text+0x1e9): undefined reference to `H5Tis_variable_str'
(...)
Run Code Online (Sandbox Code Playgroud)
许多抱怨,但第一个是针对hdf5。在寻找答案时,我在 unidata上找到了该页面,该页面解释了应该与hdf5和其他库链接的地方。所以我尝试了:
> g++ -static test.cpp -lnetcdf -lhdf5_hl -lhdf5 -lz -lm
/usr/lib64/libnetcdf.a(liboc_la-ocinternal.o): In …Run Code Online (Sandbox Code Playgroud) 经过数小时的代码挖掘和Web浏览以寻找解决方案之后,我决定将我的问题发布在这里。
我目前正在使用Java 8u45。我需要允许从TextField和拖动选定的文本TextArea。尽管它可以正常运行TextField,但不能运行TextArea-选择在拖动之前就更改了。
在一些工作示例下面-只需选择部分文本并将其拖到例如记事本的某个位置即可:
public class DnD extends Application
{
private static final GridPane rootPane = new GridPane();
private TextField textField;
private TextArea textArea;
public static void main( final String[] args )
{
launch( args );
}
@Override
public void start( final Stage primaryStage )
{
primaryStage.setTitle( "Drag and Drop Application" );
buildGui();
installDnd();
primaryStage.setScene( new Scene( rootPane, 400, 325 ) );
primaryStage.show();
}
private void installDnd()
{
textField.setOnDragDetected( e -> { …Run Code Online (Sandbox Code Playgroud) 我有一个课程如下:
package org.requiredinput.rpg1.desktop;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import org.requiredinput.rpg1.Rpg1;
public class DesktopLauncher {
public static void main (String[] arg) {
LwjglApplicationConfiguration config =
new LwjglApplicationConfiguration();
config.title = "Awesome rpg";
config.width = 800;
config.height = 480;
new LwjglApplication(new Rpg1(), config);
}
}
Run Code Online (Sandbox Code Playgroud)
我的问题是 - 在最后一行,使用的new语句没有前面的=.正在创造什么?一个新LwjglApplication对象?类?
为什么不需要像实例那样app = new LwjglApplication()进行实例化?