Though it perfectly compiles (CMakeFiles.txt contains proper include_directories), in editor I have "not found" for opencv2 at
#include <opencv2/opencv.hpp>
and name resolution and completion doesn't work of course, marking them "can't resolve".
What am I doing wrong?
seems include_directories absolute path doesn't work for editor at least on windows - relative path from the project folder macro made the trick...
Related
I'm new on this Makefile thing, and I'm having some issues trying to install the Makefile Extension from the VS Code Marketplace.
First of all, I'm using VS Code to connect to a remote machine, with RedHat8 kernel. It uses makefile and it works perfectly on a linux terminal, but now we are trying to migrate to VS Code.
So I was searching and I found this Makefile Extension.
On the extension settings, I have my Makefile Path defined, and it works, but I have some problem with the Make Path, because it is expecting a make.exe kind but I don't have any, because it's a linux server.
I know my make path is on /usr/bin/make, but it says it cannot find make path.
What should I put in there?
PS: Sorry for my bad english, and thank you!
You should not have to set the "Make Path" to anything, it should default to make.
By default the "Makefile Path" is ${workspaceFolder}/Makefile, but you can change it to whatever is required.
If you have a separate build folder, then it's better to set the "Make directory" instead.
For example, Debian packages are built under debian/build/main so set the makeDirectory like this:
{
"makefile.makeDirectory": "${workspaceFolder}/debian/build/main"
}
I have downloaded the boost library and want to include it in visual c++, but after copying in a piece of example code from the boost website, I get the error
"LNK1104 cannot open file 'libboost_regex-vc100-mt-gd-1_54'"
The file certainly exists. I'm guessing it was created when I ran the bootstrap command in the command prompt, which I followed from the guide https://www.youtube.com/watch?v=6trC5zVXzG0
The example file I use is as follows:
#include <boost/regex.hpp>
#include <iostream>
#include <string>
using namespace std;
int main()
{
string line;
boost::regex pat("^Subject: (Re: |Aw: )*(.*)");
while (cin)
{
getline(cin, line);
boost::smatch matches;
if (boost::regex_match(line, matches, pat))
cout << matches[2] << endl;
}
return 0;
}
I'm sorry but I know this kind of question has appeared several times on stack overflow, but I have tried most of the solutions I've seen and the error still exists.
Inside the solution explorer in visual c++ 2015, I write click on my proect and then click on properties, then under the VC++ directories tab, I've added the directory "C:\Program Files\Boost" into include directories, and the directory "C:\Program Files\Boost\stage\lib" into library directories. But the problem still exists. Similar questions on stack have asked to add the directory "C:\Program Files\Boost\stage\lib" to the Additional Include Directories under the general tab under the C/C++ tab, and to the Additional Include Directories under the General tab inside the Linker tab. But all these changes made no difference to the error. Another solution on stack said to add the directory "C:\Program Files\Boost\stage\lib" to the Additional dependencies under the input tab under the Linker tab, but when I did this the error changed to:
"LNK1104 cannot open file 'C:\Program Files\Boost\stage\lib.ob'"
I'm not sure if this is an improvement to the error or not
So after trying all these solutions which seemed to work for other people, I keep getting the same error. So does anyone know what could be the cause of the error.
You are getting a LNK error, which means it's likely that something is missing from your Linker properties. Make sure you've added both the boost folder and the boost\stage\lib folder to the Project Properties > configuration > Linker > "Additional Library Directories".
Also note that if you're using Visual Studio 2015, you should probably have generated the boost binaries using msvc-14.0, not msvc-10.0. Otherwise, your Platform Toolset property should be set to v100 (the default will be v140). You change this setting from Project Properties > configuration > General > "Platform Toolset", but you would need to have that version of visual studio installed.
If Aciel's answer haven't solve your problem(because I saw you haven't accept that answer yet), I believe it is because you compile your boost lib to 32-bit, and you use them in a 64-bit program.
If it's so, please try
bjam --toolset=msvc-14.0 --build-type=complete address-model=64
to rebuild your boost lib to 64-bit
I am trying to compile this project - It compiles perfectly in
Linux(ubuntu). But I want it to work on Windows. So I installed MinGW
(which comes with Jamplus installed) - and went ahead installing all the
libs needed for the project. After doing that (phew!) - I downloaded the
src of this project and did './autogen' + './configure -prefix=/mingw' and
then when I do jam, I get "unknown rule" warning. Is it because they are
unix commands and MinGW is not able to understand it?? Or is it jam? It is not able to understand lines like "UseAutoconf" and "Install Docs" - I am relatively new to Jam build system any help will be appreciated. Thanks.
Here is the jamfile - http://pastebin.com/z3FsMjDt
http://i1268.photobucket.com/albums/jj568/amitahire/jam-minggw.png
And also when I did ./autogen - it said
configure.ac:144: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call
detected in body
/mingw/src/autoconf/26/autoconf2.5-2.68-1/src/autoconf-2.68/lib/autoconf/lang.m4:194:
AC_LANG_CONFTEST is expanded from...
/mingw/src/autoconf/26/autoconf2.5-2.68-1/src/autoconf-2.68/lib/autoconf/general.m4:2662:
_AC_LINK_IFELSE is expanded from... /mingw/src/autoconf/26/autoconf2.5-2.68-1/src/autoconf-2.68/lib/autoconf/general.m4:2679:
AC_LINK_IFELSE is expanded from... mk/autoconf/np_findlib.m4:3:
NP_FINDLIB is expanded from... configure.ac:144: the top level
another six more of these. But I ignored it and went ahead with the configure progress which had no problem.
EDIT - THIS SEEMS TO SOLVE THE ISSUE.
This particular project (i suppose) isnt compiling with Jamplus 0.3. Hence when I tried with Jam 2.5 (or Ftjam) it compiles.
The console output contains several error messages like "Jamfile.jam: No such file or directory". I don't use jam on Windows, but AFAIK the standard (Perforce) jam expects jamfiles to be named just "Jamfile" on Windows as well. My guess is that Jamplus simply isn't compatible with the generated build system. Renaming the jamfiles may help, but installing the jam the build system expects is probably the safest solution.
I got this error while (re)building, using cygwin make.exe version :3.81.
Error : *** target pattern contains no `%'.
This error is due to a presence of a ":". Therefore it no longer supports windows paths.
You need to download version 3.80 and replace the make.exe in the \bin directory.
Apparently it needs cygintl12.dll too.
rollback to make 3.80 (Geant4)
cd /usr/bin
mv make.exe make_381.exe
wget http://geant4.cern.ch/support/extras/cygwin/make.exe
chmod +x make.exe
install libintl2 from cygwin setup for the required cygintl-2.dll
I got the same error when trying to build a project on Linux or OSX, that was previously built on a Windows machine and had some .o.d files hanging around in the output folder.
Once I manually deleted the .o.d files the problem was resolved. Apparently the "Clean" command of my IDE (CodeLite in this case) wasn't deleting the .o.d files.
Most likely due to the presence of a colon following a drive letter. For example consider
build : $(NativeHeaders)/*
If
NativeHeaders=../../../cpp/generated
then all is well, but
NativeHeaders=C:/dev/folder/cpp/generated
results in the error that you get.
I was getting this error because I didn't have a Tab (\t) character at the beginning of my commands. I had expandtab in my vim set so it was replacing a tab character with 4 spaces. When I turned that off and changed spaces to a tab it was fixed
I had the target pattern contains no '%' error while building with the Android NDK using cygwin.
I found the following link helpful:
Errors Generated by Make
‘missing target pattern. Stop.’
‘multiple target patterns. Stop.’
‘target pattern contains no `%'. Stop.’
‘mixed implicit and static pattern rules. Stop.’
These are generated for malformed static pattern rules. The first means there’s no pattern in the target section of the rule; the second means there are multiple patterns in the target section; the third means the target doesn’t contain a pattern character (%); and the fourth means that all three parts of the static pattern rule contain pattern characters (%)–only the first two parts should. If you see these errors and you aren’t trying to create a static pattern rule, check the value of any variables in your target and prerequisite lists to be sure they do not contain colons. See Syntax of Static Pattern Rules.
And so, my solution included changing my system variables from Windows format to Unix format like so:
Instead of C:\Android\android-ndk-r10c, I used /cygdrive/c/Android/android-ndk-r10c for the NDK path.
Similarly, I changed the NDK project path to /cygdrive/c/Android/project/src/main/jni.
In my case I was using CMake under Cygwin when I got this error. It turned out the Windows version of CMake was executed. Subsequently, Windows paths were used in the make file. I installed Cygwin's version of CMake through the setup program and got it working.
I had this problem on Linux when the build directory contained a ":" caused by doing a mercurial checkout which created a directory named "server:port".
I had to change the following in my make file to be compatible with Make_381:
before:
ARDUINO_BASE_DIR = C:\programs/arduino
now:
ARDUINO_BASE_DIR = \\programs/arduino
Try this if you're running Eclipse C/C++ and referencing files from Cygwin under Windows, make sure c:/cygwin/bin or c:/cygwin64/bin comes after your preferred compiler tools in your Windows Path environment.
Example:
Path = ;C:\yagarto\bin;C:\yagarto-tools\bin;C:\cygwin64\bin;
After making the changes, exit Eclipse and restart for it to take effect (simply restarting Eclipse without exiting won't fix the problem.
In my project, obj folder was probably corrupted and I was getting this error. Manually deleted obj folder. Then ndk-build completed fine.
Today is officially my first day with C++ :P
I've downloaded Visual C++ 2005 Express Edition and Microsoft Platform SDK for Windows Server 2003 SP1, because I want to get my hands on the open source Enso Project.
So, after installing scons I went to the console and tried to compile it using scons, but I got this error:
C:\oreyes\apps\enso\enso-read-only\src\platform\win32\Include\WinSdk.h(64) : fatal error C1083: Cannot open include file: 'Windows.h': No such file or directory
scons: *** [src\platform\win32\InputManager\AsyncEventProcessorRegistry.obj] Error 2
scons: building terminated because of errors.
After checking these links:
VS ans PSDK
Include tiffi.h
Wndows.h
I've managed to configure my installation like this:
And even run this script
And I managed to compile the file below in the IDE.
// Test.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <Windows.h>
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
But I still get that exception in the console. Does anyone have scons experience?
EDIT
Actually (and I forgot to tell you this) I started the command prompt with the link "Visual Studio 2005 Command Prompt".
I assume this will include the paths in environment variables. Well after printing them I find that it didn't:
echo %INCLUDE%
echo %LIB%
echo %PATH%
And they were not present, so I created this .bat file:
set PATH=%PATH%;"C:\Program Files\Microsoft Platform SDK\Bin"
set INCLUDE=%INCLUDE%;"C:\ Program Files\Microsoft Platform SDK\Include"
set LIB=%LIB%;"C:\ Program Files\Microsoft Platform SDK\Lib"
Still, scons seeems not to take the vars... :(
Using the above recommendations will not work with scons: scons does not import the user environment (PATH and other variables). The fundamental problem is that scons does not handle recent versions of SDKs/VS .
I am an occasional contributor to scons, and am working on this feature ATM. Hopefully, it will be included soon in scons, but the feature is much harder to implement reliably than I first expected, partly because every sdk/compiler combination is different (and sometimes even MS does not get it right, some of their .bat files are broken), so I can't give you a date. I hope it will be included in 1.2 (to be released in approximatively one month).
You need to set the include file path (and possibly other things). At the command line this is typically done using a batch file that Visual Studio installs called vsvars32.bat (or vcvars32.bat for compatibility with VC6).
I'm not familiar with scons so I don't know the best way to get these settings configured for that tool, but for standard makefiles there's usually a line in the makefile which sets a macro variable with the include directory path and that macro is used as part of a command line parameter in the command that invokes the compiler.
Another possibility might be to have the scons process invoke vsvars32.bat or run the scons script from a command line that has been configured with the batch file.
In short you need to get the things that vsvars32.bat configures into the scons configuration somehow.
There will be a batch file similar to this one (for MSVC 2005) that sets up the environment variables:
c:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat
Step 1: Find a similar file in the Express installation folders
Step 2: Create a shortcut on the desktop with these target details and a suitably modified path:
cmd.exe /K "c:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat"
Step 3: Open the DOS prompt via this shortcut
The command line build should now work from within this console window.
You show us how you configured Visual Studio for compilations within Visual Studio but you didn't show us what command line environment you tried. Sorry I haven't tried Express versions so I don't know if they create additional Start menu shortcuts like Pro and above do. If you open a suitable command prompt with its environment variables already set then you can compile on the command line. Otherwise you have to set variables yourself or execute a batch script to set them, each time you open a command prompt.
It'll be nice when scons does this automatically. For now, I use this (run from an SDK command prompt, not sure if there is a difference if run after vsvars32.bat):
import os
env = Environment(ENV={'PATH': os.environ['PATH']})
env['ENV']['TMP'] = os.environ['TMP']
env.AppendUnique(CPPPATH=os.environ['INCLUDE'].split(';'))
env.AppendUnique(LIBPATH=os.environ['LIB'].split(';'))
This works for me while compiling wxwidgets with Visual C++ 2005 Express using the command line prompt:
REM Fix Error error C1083 'windows.h'
(Use /useenv option when compiling.)
set PDSKWIN=C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2
(Change to the right one.)
set INCLUDE=%PDSKWIN%\Include;%INCLUDE%
set LIB=%PDSKWIN%\Lib;%LIB%
Then I use this line when compiling. I believe just add /useenv to your lines and everything should work fine:
vcbuild /useenv /nohtmllog /nologo name.proj (or any file to compile)