简体   繁体   中英

C++ Permission Denied Error

I'm fairly new to C++, I've been coding in Java for a few years. About a week ago I tried getting the Boost library to work with Codeblocks, and have run into error after error after error. I've managed to fix most of them but this one is driving me up a wall. My code returns two errors when compiled:

ld.exe||cannot find C:\\boost_1_60_0\\stage\\lib: Permission denied|

||error: ld returned 1 exit status|

I simply cannot figure out how to fix this, I've been searching for help online for days. From what I've been able to figure out, the permission denied error is due to (as the error suggests) lack of permission to access the directory, but none of the fixes I've found online have worked.

Here is my code, although I don't think the code is related to the error.

#include "complex.h"
#include <cmath>
using namespace csis3700;

#define BOOST_TEST_MODULE ComplexTests
#define BOOST_TEST_DYN_LINK

#include <boost/test/unit_test.hpp>

const double tol = 0.01;

BOOST_AUTO_TEST_CASE(zero_arg_constructor_should_not_crash) {
    complex c;
}

The complex class is just a class that simulates complex numbers, right now it is just an empty constructor.

Build settings:

在此处输入图片说明

Your search directories does not include that folder. Double check that your search directories tab is populated with "C:\\boost_1_60_0\\stage\\lib" or if you are using an environment variable, that it is set and linked properly here.

Additionally the error specifically is because you are looking for boost.lib as a file and not as a directory. Removing this from your current linker settings and moving it under the search directories->linker tab should resolve the error.

You might have missed "return 0;" in the main file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM