Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I have a project that can use boost library and it can also not to use it.
I have a property sheet use_boost that can be added to the project and there are set the path to boost and a <PreprocessorDefinitions> tag with value I_AM_USING_BOOST.
In the code I have something like:
#ifdef I_AM_USING_BOOST
#include <boost/any.hpp>
#else
#include <string>
#endif
namespace test
{
#ifdef I_AM_USING_BOOST
using my_defined_type = boost::any;
#else
using my_defined_type = std::string;
#endif
}
So if I do not want a build with boost, I remove the property sheet.
If I want to build with boost, I add the property sheet to the project.
Now, I want to build both variations of the library: one using boost and one not using boost.
Can I have a single project with two different builds: one with boost and one without boost, but not manually add or remove the property sheet?
I build using msbuild from a batch file.
As a solution for me, I've added a new project configuration (Release_no_boost) and in that configuration I've removed the property sheet using boost library.
So, in the batch file I can now run msbuild for both variations by calling different configurations.
I have now in the batch file:
msbuild /t:rebuild /p:Configuration=Release D:\projects\some_test\test_1\test_1.vcxproj
msbuild /t:rebuild /p:Configuration=Release_no_boost D:\projects\some_test\test_1\test_1.vcxproj
This can be also used for a solution with multiple project, but it is needed to be created a solution configuration and for each project in the solution that is build, it is set the project configuration that is wanted.
Difference in batch is that instead of the project file it is given as parameter the solution file:
msbuild /t:rebuild /p:Configuration=Release D:\projects\some_test\some_test.sln
msbuild /t:rebuild /p:Configuration=Release_no_boost D:\projects\some_test\some_test.sln
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
How to integrate Eclipse, systemc-2.3.3, and cygwin on Windows?
Below I am going to share how I could integrate eclipse, systemc-2.3.3, and cygwin on a windows operating system.
Requirements:
Eclipse: you can download and install it from https://www.eclipse.org/downloads/
cygwin: you can download and install it from https://cygwin.com/install.html. Make sure to include the following packages:
enter image description here
systemc-2.3.3: you can download the zip file from https://www.accellera.org/downloads/standards/systemc and extract the folder in your local disk (e.g., c:\systemc).
Instructions:
Please read the content of the INSTALL file included in the systemc extracted folder.
Open CygWin64 terminal.
Navigate to the folder you have extracted the systemc zip file.
Create temporary directory "objdir" via "mkdir objdir" as explained in the INSTALL file.
Change to the temporary directory via "cd objdir" as explained in the INSTALL file.
Choose your compiler export CXX="g++ -std=c++14". If you would like to include fixed-point library you need to add DSC_INCLUDE_FX flag to the compiler definition, i.e., export CXX="g++ -std=c++14 -DSC_INCLUDE_FX ".
run configure file as "../configure --prefix="location of the libs", e.g., "/sysclibs"
After MakeFile is successfully created run it via "make"
After the run is successful execute "make install". At this point you have created the system c libraries in "cygwin64/syslibs".
Now open eclipse and create a C++ project, and select "Cygwin GCC" in the Toolchains listbox.
Go to "project properties" and under "C/C++ Build" menu select "Settings"->"Cygwin C++ Compiler". In the "Command" editor type "g++ -std=c++14". Press "Apply". Do the same for "Cygwin C++ Linker". If you have included the fixed-point library, add -SC_INCLUDE_FX to the Miscellaneous of the C++ compiler.
Under "C/C++ General" menu select "Path and Symbols". Under "Includes" tap add the path to systemc compiled include folder, e.g., "cygwin64/syslibs/include".
Under "Library Paths" add the path to the compile system c libraries, e.g., "cygwin64/syslibs/lib-cygwin64".
Under "Libraries" tap, add "systemc". Just press add and type "systemc".
Compile the following code, and if there is no error, you have set up your environment properly.
#include <iostream>
using namespace std;
#include "systemc.h"
int sc_main(int, char* []) {
cout << "Done." << endl; // prints !!!Hello World!!!
return 0;
}
If you have included the fixed-point library, and Eclipse cannot resolve the defined fixed-point types, do as what follows.
Open "/include/systemc"
Remove "#ifdef SC_INCLUDE_FX" and its corresponding "endif".
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
The JavaScript IntelliSense is not working on Visual Studio 2017 RTM editor. I can’t even format the code, nothing is working.
UPDATE: Looks like latest update of VS 2017 (15.3) solve the issue.
This is because of the new javascript language service
http://aka.ms/JavaScriptExperimental
To disable and bring back JS, go to: Tools - Options - text editor - Javascript/Typescript - Language service - General and disable the very first option.
Enabling Auto List members helped me:
On the menu go to:
Tools > Options >> Text Editor >> All Languages >> General
Uncheck and check back "Auto List Members" to make it a check sign instead of a square
Uncheck and check back "Parameter Information" to make it a check sign instead of a square
The problem might be that you have too much JavaScript being analyzed due to particularly large JS libs. You can exclude those from your project with a tsconfig.json file (example below). The only catch is any library you exclude from your project must be explicitly included in the "typeAcquisition" settings in order to get IntelliSense for it.
{
"compilerOptions": {
"allowJs": true,
"noEmit": true,
"lib": ["es2016", "dom"] // only necessary if you need new stuff like promises
},
"exclude": [
"wwwroot/lib/" //add folders that contain javascript libraries here
],
"typeAcquisition": {
"enable": true,
"include": [
"jquery" // add any libraries excluded in the folders above here
]
}
}
Based on which type Project you're working you must install the jquery or other libraries to be helped by Intellisense.
For exemple: if you're using ASPNET Core and want to be helped with jquery statments, you must add a bower configuration file, and then add a Key/Value pair in this file:
"jquery":"version"...
After that, build the Project and enjoy the Intellisense working.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
How do you install and use OpenCV 2.4.3 under VC++ 2010 Express?
1. Installing OpenCV 2.4.3
First, get OpenCV 2.4.3 from sourceforge.net. Its a self-extracting so just double click to start the installation. Install it in a directory, say C:\.
Wait until all files get extracted. It will create a new directory C:\opencv which
contains OpenCV header files, libraries, code samples, etc.
Now you need to add the directory C:\opencv\build\x86\vc10\bin to your system PATH. This directory contains OpenCV DLLs required for running your code.
Open Control Panel → System → Advanced system settings → Advanced Tab → Environment variables...
On the System Variables section, select Path (1), Edit (2), and type C:\opencv\build\x86\vc10\bin; (3), then click Ok.
On some computers, you may need to restart your computer for the system to recognize the environment path variables.
This will completes the OpenCV 2.4.3 installation on your computer.
2. Create a new project and set up Visual C++
Open Visual C++ and select File → New → Project... → Visual C++ → Empty Project. Give a name for your project (e.g: cvtest) and set the project location (e.g: c:\projects).
Click Ok. Visual C++ will create an empty project.
Make sure that "Debug" is selected in the solution configuration combobox. Right-click cvtest and select Properties → VC++ Directories.
Select Include Directories to add a new entry and type C:\opencv\build\include.
Click Ok to close the dialog.
Back to the Property dialog, select Library Directories to add a new entry and type C:\opencv\build\x86\vc10\lib.
Click Ok to close the dialog.
Back to the property dialog, select Linker → Input → Additional Dependencies to add new entries. On the popup dialog, type the files below:
opencv_calib3d243d.lib
opencv_contrib243d.lib
opencv_core243d.lib
opencv_features2d243d.lib
opencv_flann243d.lib
opencv_gpu243d.lib
opencv_haartraining_engined.lib
opencv_highgui243d.lib
opencv_imgproc243d.lib
opencv_legacy243d.lib
opencv_ml243d.lib
opencv_nonfree243d.lib
opencv_objdetect243d.lib
opencv_photo243d.lib
opencv_stitching243d.lib
opencv_ts243d.lib
opencv_video243d.lib
opencv_videostab243d.lib
Note that the filenames end with "d" (for "debug"). Also note that if you have installed another version of OpenCV (say 2.4.9) these filenames will end with 249d instead of 243d (opencv_core249d.lib..etc).
Click Ok to close the dialog. Click Ok on the project properties dialog to save all settings.
NOTE:
These steps will configure Visual C++ for the "Debug" solution. For "Release" solution (optional), you need to
repeat adding the OpenCV directories and in Additional
Dependencies section, use:
opencv_core243.lib
opencv_imgproc243.lib
...
instead of:
opencv_core243d.lib
opencv_imgproc243d.lib
...
You've done setting up Visual C++, now is the time to write the real code. Right click your project and select Add → New Item... → Visual C++ → C++ File.
Name your file (e.g: loadimg.cpp) and click Ok. Type the code below in the editor:
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main()
{
Mat im = imread("c:/full/path/to/lena.jpg");
if (im.empty())
{
cout << "Cannot load image!" << endl;
return -1;
}
imshow("Image", im);
waitKey(0);
}
The code above will load c:\full\path\to\lena.jpg and display the image. You can
use any image you like, just make sure the path to the image is correct.
Type F5 to compile the code, and it will display the image in a nice window.
And that is your first OpenCV program!
3. Where to go from here?
Now that your OpenCV environment is ready, what's next?
Go to the samples dir → c:\opencv\samples\cpp.
Read and compile some code.
Write your own code.
Trying to run the following:
#include<iostream>
#include<boost/filesystem/operations.hpp>
namespace bfs=boost::filesystem;
int main()
{
bfs::path p("second.cpp");
if(bfs::exists(p))
std::cout<<p.leaf()<<std::endl;
}
I got some errors in cygwin so I decided to try out netbeans, and used the following as a guide. I added all links and the following for filesystem Project -> properties -> Linker ->Libraries -> Add option -> Other -> -lfile_system as noted here. I have run a separate test using #include<boost/any.hpp> so I am not currently doubting that my boost is not installed correclty.
It seems weird to me that it is "file_system", so I also tried "filesystem" but to no avail.
When i hold Ctrl and click on #include<boost/filesystem/operations.hpp> my netbeans brings up my operations.hpp file so it seems okay (linked properly internally that it can "see" what I want it to see).
The solution to installing boost came in the following form:
1 - If you have any path variables that are being used for Visual Studio you should temporarily change the variable during installation. This is a good guide. Once that is done, this is one step completed.
2 - Download and install MinGW. This is a very easy process and you can find the installer files here.
Once you have done these things (if you are in the same situation as me), you will now be able to properly install boost.
Horay!
Using Boost with cygwin step by step
Create a new Project
It is better to take the names given here in this tutorial exactly. Later ask: It does not work, can then be easier to find.
I do not think I need to mention all T:\ must of course be replaced with your drive.
Project Name : Boost-cyg-Test
Now your Project should look like
Open main.cpp
Overwrite the generated code with the following. We want to that, first of all everything works without error.
Therefore, please do not use your own special code.
It is difficult to find a fault. Then told after several ask, to get:
I have used my own code
#include <iostream>
#include <boost/filesystem.hpp>
using namespace std;
using namespace boost::filesystem;
int main()
{
path p("second.cpp");
if (exists(p)) { std::cout<<p.leaf()<<std::endl; }
}
In this section we assume that "boost" is already compiled.
goto Tools -> Options
Your C++ Code Assistance options should look something like this.
If this is not so, we should let Netbeans create that for us.
Add New Tool Collection
After we have completed this dialog with OK, we should find the settings shown above. ( C++ Code Assistance options).
Copy all libs into the right place
Let's create a new folder 'boost'.
With a search tool, search in your compiled Boost folder for *.a
My Boost is compiled with the shared option so we find :
For our short App. we need only 2 files.
libboost_filesystem-gcc45-mt-d-1_53.dll.a
libboost_system-gcc45-mt-d-1_53.dll.a
But if we're at it to copy two files, we can copy all files.
So mark all found .a files and copy them into the directory just created
T:\cygwin\lib\boost .
Now we do the same with our .dll files.
Mark all .dll files and copy it in your ?:\cygwin\bin directory.
If you only have compiled static librarys, you can skip this point.
Now it's time to modify our project settings.
As you can see i put my source Boost folder into cygwin
and
As we have already noted above, we need two .a files.
with Add Library navigate to T:\cygwin\lib\boost and select
libboost_filesystem-gcc45-mt-d-1_53.dll.a
libboost_system-gcc45-mt-d-1_53.dll.a
Now you'll notice that this name was shortened by netbeans to:
boost_filesystem-gcc45-mt-d-1_53.dll
boost_system-gcc45-mt-d-1_53.dll
This is somewhat confusing. It looks as if a .dll is standing here. But it is really a .a file.
Set a breakpoint in main.cpp. Now we start debug.
I have marked the important part, the two libs, with an arrow.
All libs are found and after make has finished, stops at the breakpoint.
The output:
Build Boost for Cygwin
For all who want to create boost with shared library itself.
Download boost_1_53_0.zip
Create a folder in your ?:\cygwin directory.
boost_1_53_0
Extract the zip file into that directory.
It should look like:
open a cmd window, cd to boost_1_53_0 directory.
To have a clean build we need a PATH that have only the cygwin home and bin.
In the cmd type.
SET PATH=T:\cygwin;T:\cygwin\bin
and test the path.
PATH
Type
bootstrap.bat
Type
.\b2 --build-dir=T:\boost-cyg toolset=gcc variant=debug link=shared runtime-link=shared
After some time the build is finished.
Now you have the same environment that we have used in the tutorial.
If you get a Error : gcc not found
copy (not rename) in ?:\cygwin\bin folder, for example : (names may differ).
i686-pc-cygwin-gcc-4.5.3.exe to gcc.exe
and
i686-pc-cygwin-g++-4.exe to g++.exe
Hope it helps you.
Could you paste the error you get when compiling ?
I am not used to compile programs in a Windows environment, but I think as Jesse Good suggested in a comment that you have a linker error.
You may solve it by using -lboost_filesystem instead of lfile_system.
To find out how your libs are called, you get the name of your lib (on my unix environment I have libboost_filesystem.so), strip the "lib" prefix and the ".so" or ".a" suffix (must be different in a Windows environment).
if your boost installation is correct and you are sure about it then for Unable to resolve identifier try Code Assistance->Reparse Project from context menu of the project. It tries to recover broken code model by reparsing project from scratch. if that didn't workout try closing IDE and removing code model cache.
p.s. do you have compilation errors?
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
How do you install and use OpenCV 2.4.3 under VC++ 2010 Express?
1. Installing OpenCV 2.4.3
First, get OpenCV 2.4.3 from sourceforge.net. Its a self-extracting so just double click to start the installation. Install it in a directory, say C:\.
Wait until all files get extracted. It will create a new directory C:\opencv which
contains OpenCV header files, libraries, code samples, etc.
Now you need to add the directory C:\opencv\build\x86\vc10\bin to your system PATH. This directory contains OpenCV DLLs required for running your code.
Open Control Panel → System → Advanced system settings → Advanced Tab → Environment variables...
On the System Variables section, select Path (1), Edit (2), and type C:\opencv\build\x86\vc10\bin; (3), then click Ok.
On some computers, you may need to restart your computer for the system to recognize the environment path variables.
This will completes the OpenCV 2.4.3 installation on your computer.
2. Create a new project and set up Visual C++
Open Visual C++ and select File → New → Project... → Visual C++ → Empty Project. Give a name for your project (e.g: cvtest) and set the project location (e.g: c:\projects).
Click Ok. Visual C++ will create an empty project.
Make sure that "Debug" is selected in the solution configuration combobox. Right-click cvtest and select Properties → VC++ Directories.
Select Include Directories to add a new entry and type C:\opencv\build\include.
Click Ok to close the dialog.
Back to the Property dialog, select Library Directories to add a new entry and type C:\opencv\build\x86\vc10\lib.
Click Ok to close the dialog.
Back to the property dialog, select Linker → Input → Additional Dependencies to add new entries. On the popup dialog, type the files below:
opencv_calib3d243d.lib
opencv_contrib243d.lib
opencv_core243d.lib
opencv_features2d243d.lib
opencv_flann243d.lib
opencv_gpu243d.lib
opencv_haartraining_engined.lib
opencv_highgui243d.lib
opencv_imgproc243d.lib
opencv_legacy243d.lib
opencv_ml243d.lib
opencv_nonfree243d.lib
opencv_objdetect243d.lib
opencv_photo243d.lib
opencv_stitching243d.lib
opencv_ts243d.lib
opencv_video243d.lib
opencv_videostab243d.lib
Note that the filenames end with "d" (for "debug"). Also note that if you have installed another version of OpenCV (say 2.4.9) these filenames will end with 249d instead of 243d (opencv_core249d.lib..etc).
Click Ok to close the dialog. Click Ok on the project properties dialog to save all settings.
NOTE:
These steps will configure Visual C++ for the "Debug" solution. For "Release" solution (optional), you need to
repeat adding the OpenCV directories and in Additional
Dependencies section, use:
opencv_core243.lib
opencv_imgproc243.lib
...
instead of:
opencv_core243d.lib
opencv_imgproc243d.lib
...
You've done setting up Visual C++, now is the time to write the real code. Right click your project and select Add → New Item... → Visual C++ → C++ File.
Name your file (e.g: loadimg.cpp) and click Ok. Type the code below in the editor:
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main()
{
Mat im = imread("c:/full/path/to/lena.jpg");
if (im.empty())
{
cout << "Cannot load image!" << endl;
return -1;
}
imshow("Image", im);
waitKey(0);
}
The code above will load c:\full\path\to\lena.jpg and display the image. You can
use any image you like, just make sure the path to the image is correct.
Type F5 to compile the code, and it will display the image in a nice window.
And that is your first OpenCV program!
3. Where to go from here?
Now that your OpenCV environment is ready, what's next?
Go to the samples dir → c:\opencv\samples\cpp.
Read and compile some code.
Write your own code.