Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to make my program ask for admin rights when it starts.
I already found out that you can do this by doing this :
Properties -> Linker -> Manifest File -> UAC Execution Level -> requireAdministrator (/level='requireAdministrator')
So here is my actual question:
Couldn't I change this setting with my code? Because I can do this for example:
#pragma comment (lib, winmm.lib);
and adding a lib is a linker setting too.
http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.vcprojectengine.vclinkertool.uacexecutionlevel.aspx
I found this but it doesn't seem to work for me, or is there something I may forget by using this code, beacause the compiler tells me that property is undefined?
No you can't do that from code. The #pragma comment directive can pass some information to the linker but it only supports a limited subset of linker commands:
Only the following (comment-type) linker options are available to be
passed to the linker identifier:
/DEFAULTLIB
/EXPORT
/INCLUDE
/MANIFESTDEPENDENCY
/MERGE
/SECTION
Related
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 3 days ago.
Improve this question
I'm trying to recompile a Windows C++ app inside a new compiler (RAD Studio 11). I'm an absolute beginner and running into a problem.
There is a .cbproj, DatabaseCppUtilities (32-bit), which threw an error. For it to compile and link successfully, I included dbrtl.lib so it could find Data::DB::TDataSet::GetRecord.
Now I'm compiling a different .cbproj of the app, which is using DatabaseCppUtilities, and it gives me this error:
[ilink32 Error] Fatal: Unable to open file 'DATA.OBJ'
I have the feeling it's related to the dbrtl.lib.
As I already said, I'm an absolute beginner, and maybe I'm missing something really simple, but for now I can't see what to do next.
I tried searching for the .obj file in the intermediate output directories, but can't seem to find any file named Data.obj.
I tried adding the dbrtl.lib to the different .cbproj using #pragma link "dbrtl.lib" and putting its path in the Shared Options > Library path.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
i have these files:-
/lib
kernel.hpp
kernel.cpp
main.cpp
when i use
gcc -m32 -c main.cpp -lstdc++ -o main.o -llib/kernel.hpp
it says
[function name]([type of argument 1], [type of argument 2]) is not declared in this scope
how to fix?
I started writing a comment, but got to be too long, so we'll make it an answer instead. I don't think it in fact will answer your question, but it may point you in the right direction.
Let's clear up a misconception, c++ is not a superset of c; there are c constructs that c++ does not support. If your code is c++, you need to compile it with a c++ compiler. The problems you've been describing all indicate that compilation is failing; you're not at the point where the linker is involved. The compile command you provided in your question had a -c flag, which tells the compiler to stop after the compilation step - so there's no point in having a -lstd++ flag in addition. For the compiler to find kernel.hpp you need a -I flag which indicates the directory where kernel.hpp can be found. That's what I was suggesting in my first comment.
To sum up, as shown in the original question, you're using the wrong compiler and the wrong flags for what you want to do.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I want to use Tensorflow shared object in my other C++ code, named as Temp_TF.cc
I am using the following command to create an executable.
g++ ../../../bazel-bin/tensorflow/cc/example/Temp_TF.so -ltensorflow_cc Temp_TF.cc -o Temp_TF
What is wrong with the following command?
I am getting the following error:
Temp_TF.cc:3:49: fatal error: tensorflow/cc/client/client_session.h: No such file or directory
compilation terminated.
I can see you're new to Stack Overflow.
Technically your question does not have enough data for us to provide an answer for sure.
However it looks to me as though you're missing a -I (capital i) directive and the compiler does not know where to find the tensorflow/cc/client/client_session.h path.
From the look of it, you could try:
g++ -I ../../../bazel-bin ../../../bazel-bin/tensorflow/cc/example/Temp_TF.so -ltensorflow_cc Temp_TF.cc -o Temp_TF
(note the -I)
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 8 years ago.
Improve this question
I am trying to use Intel TBB in a segment of Xeon Phi offload code. The code fails to compile with error error : *MIC* cannot open source file "tbb\parallel_for.h"
I have the MPSS stack installed, I ran the binutils.msi utility, and my includes at the top of the offloaded code file is as follows:
#include <offload.h>
#pragma offload_attribute(push, target(mic))
#include <tbb\parallel_for.h>
#pragma offload_attribute(pop)
//other includes and code follows
Why does this fail?
What do I need to change to offload and run my code sucessfully?
EDIT :
After adding the -tbb option to the "Additional Options for MIC Offload Compiler" the compiler has found the <tbb\parallel_for.h> file however it gives several warnings and errors about tbb library code not being marked shared. follows is my offloaded code segment.
#pragma offload target(mic:0) in(nums) out(results)
tbb::parallel_for<int>(0,ARRAY_SIZE,1,[&](int i)
{
results[i] = findZero(nums[i]);
});
The offload compiler basically consists of two (very) different compilers called separately on the same code. Each of them generally has its own command line, include, and library paths; and not all the command line options translated from host to the MIC compiler. In case of TBB, compiler has special option /Qtbb or just -tbb which takes care of all the paths for both compilers.
Please refer to tbb\examples\GettingStarted\SUB_STRING_FINDER\sub_string_finder_extended.cpp for how to use TBB from offload region. And check out the Makefile for how to build the example.
In order to run the code from MSVC environment, you need to setup the same environment as for Intel Compiler used to build the GettingStarted\Sub_string_finder example. The easy way to duplicate the environment inside MSVC is to run it from the same console window where the example works:
devenv /useenv
Or specifically, you need to set the MIC_LD_LIBRARY_PATH environment variable to point to MIC TBB binaries as shown here for other libraries.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I'm fairly comfortable with Linux and compiling things - I normally just follow the instructions and can manage to get myself out of trouble. This time, I was given a .cpp file by a random Internet citizen and I would really like to know how to compile it. Everything I seem to try (g++, c++, gcc) doesn't seem to work.
Anyhow, here's the file: http://pastebin.ca/2073013
Edit: Updated with verbose output from g++ file.cpp -o whatever: http://pastebin.ca/2073052
You'll need to compile it using:
g++ inputfile.cpp -o outputbinary
The file you are referring has a missing #include <cstdlib> directive, if you also include that in your file, everything shall compile fine.
The compiler is telling you that there are problems starting at line 122 in the middle of that strange FBI-CIA warning message. That message is not valid C++ code and is NOT commented out so of course it will cause compiler errors. Try removing that entire message.
Also, I agree with In silico: you should always tell us what you tried and exactly what error messages you got.
Just type the code and save it in .cpp format. then try "gcc filename.cpp" . This will create the object file. then try "./a.out" (This is the default object file name). If you want to know about gcc you can always try "man gcc"