Skip to content

.dll file exported from Release can't be used for Debug #168

Description

@Yuanen-Pang

Thanks for your valuable work! I meet some problem and I'd like to report it.
I compile the netcdf-cxx4.dll using vs2019, as well as .lib file. Then I start my own project and try to run it under Debug mode, but a very strange error appears:

Code:

#include <netcdf>
#include <netcdf.h>
#include <iostream>
#include <vector>
using namespace netCDF;
using namespace netCDF::exceptions;
int main() {
    int ncid;
    int ret = nc_open("test.nc", NC_NOWRITE, &ncid);
    if (ret != NC_NOERR) {
        std::cerr << "nc_open failed: " << nc_strerror(ret) << " (" << ret << ")\n";
    }
    else {
        nc_close(ncid);
        printf("Successfully opened using c function!\n\n");
    }

    try {
        NcFile file("D:/MyDoc/Program/MachineLearning/Learning/netcdf/test.nc", NcFile::read);
        file.close();
    }
    catch (NcException& e) {
        std::cerr << "NetCDF error: " << e.what()
            << " code=" << e.errorCode()
            << " nc_strerror=" << nc_strerror(e.errorCode()) << std::endl;

    }
    return 0;
}

Output:

Successfully opened using c function!

NetCDF error: Invalid argument
file: D:\MyDoc\Program\Cpp\library\netcdf-cxx4-4.3.1\cxx4\ncFile.cpp  line:88 code=22 nc_strerror=Invalid argument

This error will not happen if I use netcdf-cxx4.dll compiled under Debug mode.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions