2

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:

enter image description here

sehe
  • 374,641
  • 47
  • 450
  • 633
Sova
  • 21
  • 1
  • 2
  • Maybe you installed Boost as Administrator, and your ordinary user does not have access to the directory or its contents. Can you look at the contents of the `C:\boost_1_60_0\stage\lib` directory with the user your trying to build your program? – Paulo1205 Feb 05 '16 at 21:01
  • Yes, I can view the entire contents of C:\boost_1_60_0\stage\lib. – Sova Feb 05 '16 at 21:03
  • I thought that maybe compiler (linker) was run by user, who don't have access to these dirs, which could result in error as you describe. Could you please tell us what are the permissions of this directory (e.g. by running `ls -l` command). – Piotr Smaroń Feb 05 '16 at 21:17
  • I made sure all users on my PC (even though its just me) had full access to the directory in question just in case. Error still occurs. – Sova Feb 05 '16 at 21:19
  • One solution will be to run codeblocks as administrator – M.M Feb 06 '16 at 04:01
  • Tried that as well, same error. – Sova Feb 06 '16 at 04:18
  • @sova since it's clearly an issue accessing the boost library, try reinstalling it (with the correct permissions) using the instructions I put here: http://stackoverflow.com/questions/35217511/boost-1-60-0-zip-installation-in-windows BTW I'm delighted to see that your first attempt at C++ is a test case! You're clearly bringing over good habits from Java, However, I'd recommend using a different example class than complex since it's in the C++ `std`library which may cause you other problems... – kenba Feb 06 '16 at 12:04
  • Tried your instructions, still getting the same error. At this point I've tried reinstalling it in three different directories and made sure I had correct permissions all three times. – Sova Feb 07 '16 at 17:12

2 Answers2

0

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.

Poweti
  • 1
  • 2
0

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