I have a Threshold.cpp which contains the above main function
main(int argc, char *argv[])
The teacher wanted us to create an exe using the command line and then use it:
Ex:
make Threshold
-> creates Threshold.exe
Threshold imageIN.pmg ImageOut.pmg
-> does someting to imageIN and outputs it in ImageOut.
My question is, how do I use it in visual studio? I'm used to an empty main() and all I have to do is build it and an .exe will pop out. However, it doesn't work this time. The error I get is:
Threshold.exe not found or not built by the last incremental link; performing full link
Embedding manifest...
Anyone has any idea on how I can do it with visual studio?
I am sorry, but i do not want to know about microsoft, jejejejejeej.
Sorry, i am jocker.
No, i can not help you. In pure c++ i may help you, but in VS i do not have any idea.
argc is the number of argument strings in the argv[] array.
Here's an example to get you started:
1 2 3 4 5 6 7 8 9 10 11 12
#include <iomanip>
#include <iostream>
usingnamespace std;
int main( int argc, char* argv[] )
{
cout << "The name used to start the program: " << argv[ 0 ]
<< "\nArguments are:\n";
for (int n = 1; n < argc; n++)
cout << setw( 2 ) << n << ": " << argv[ n ] << '\n';
return 0;
}
Compile it, then from the command-prompt try running it different ways:
D:\prog\test> a Hello world!
The name used to start the program: a
Arguments are:
1: Hello
2: world!
D:\prog\test> cd ..
D:\prog> test\a.exe "Peter Piper" picked a peck of "pickled peppers"
The name used to start the program: test\a.exe
Arguments are:
1: Peter Piper
2: picked
3: a
4: peck
5: of
6: pickled peppers
Inside the main, it uses argc and *argv[] and I need to call it from the console like what Duoas displayed. However, I can't even compile/build it. It works with the make command of linux though so the code is fine. Eventually, I will want to hard code the main such that it'll take imageIN and output imageOUT automatically since I'll be testing it a lot.
Um, I don't think you can do that with main()...you will have to use argv to handle that...Anyway, are you looking in the directory where it is built? There should be a Debug or Release folder that the .exe is stored in.