I wrote this C code
#include <stdio.h>
int main()
{
int a;
scanf("%d", &a);
printf("%d\n", a);
getchar();
return 10;
}
However I am getting this error shown in image.
What is the problem here ?
EDIT1:
I have windows 7 x64 and running VS 15.
Seems there has been similar problem before this might be helpfull.
Visual Studio debugger error: Unable to start program Specified file cannot be found
Go to the specific file location from the error open the program from there. Build it first then try to debug it again.
Related
Im learning to use intrinsics instead of asm-inlining. Yesterday, they were working but I always get error today. Changed nothing.
#include <iostream>
#include <intrin.h> // immintrin.h, smmintrin.h ... tried all, never worked
using namespace std;
int main()
{
_m256_zeroupper(); // __mm256_zeroupper(); does not work too
_mm128 x; // __mm128 x; does not work too
_mm256 y; // __mm256 y; does not work too
_m256_zeroupper(); // __mm256_zeroupper(); does not work too
cout << "Hello world!" << endl;
return 0;
}
Here are the errors. I tried all header files for different intrinsics but errors were same. Also reinstalled gcc but did not work.
Where am I wrong? What do I need to add to actually declare these intrinsic variables and functions?
C:\indirmeDenemesi\hello_intrin\main.cpp||In function 'int main()':|
C:\indirmeDenemesi\hello_intrin\main.cpp|8|error: '_mm256_zeroupper' was not declared in this scope|
C:\indirmeDenemesi\hello_intrin\main.cpp|9|error: '_mm128' was not declared in this scope|
C:\indirmeDenemesi\hello_intrin\main.cpp|9|error: expected ';' before 'x'|
C:\indirmeDenemesi\hello_intrin\main.cpp|10|error: '_mm256' was not declared in this scope|
C:\indirmeDenemesi\hello_intrin\main.cpp|10|error: expected ';' before 'y'|
||=== Build finished: 5 errors, 0 warnings (0 minutes, 0 seconds) ===|
Using 64-bit latest version of gcc on 64bit cpu with 64 bit windows.
CPU is FX8150.
Tried -march=bdver1 -mtune=bdver1 and it produced hundreds of junk error.
Does all these mean my CPU is dying?
Edit: some other projects are working now, but I did not change anything. This must be a project-specific thing.
Using code::blocks and when I right-click on a header and select "open", it gives error "could not find" but does not give any error when compiling related to that, just error for intrinsinc commands. Same for working projects(they compile everything and work, but does not find header files when right click and click open). Maybe some other windows services were interfering? I dont know but compiler errors are vanishing and coming again, time to time. Reinstalling also codeblocks did not solve. Only some projects can use intrinsics while other projects cannot(even if all projects have same headers.)
This code below does not work too.
#include <iostream>
#include <immintrin.h>
using namespace std;
int main()
{
_m256_zeroupper();
__mm128 x;
__mm256 y;
_m256_zeroupper();
cout << "Hello world!" << endl;
return 0;
}
Three things should make your code work:
Make sure you're using the -mavx compile flag.
Your variable should be declared as __m256 not _mm256.
Make sure you're including immintrin.h
When trying to build a simple helloworld program, the next error shows up
LINK : fatal error LNK1561: entry point must be defined
I'm trying to use the systemc library in Visual Studio 2015, maybe thats the problem because, I couldn't find any help configuring this VS for systemc only for VS2010. The program is the following:
// All systemc modules should include systemc.h header file
#include "systemc.h"
// Hello_world is module name
SC_MODULE (hello_world) {
SC_CTOR (hello_world) {
// Nothing in constructor
}
void say_hello() {
//Print "Hello World" to the console.
cout << "Hello World.\n";
}
};
// sc_main in top level function like in C++ main
int sc_main(int argc, char* argv[]) {
hello_world hello("HELLO");
// Print the hello world
hello.say_hello();
return(0);
}
The curious thing is that if I exchange the sc_main for main it builds but doesn't work.
Your code is fine so you have a build issue. Check that you are pointing to the correct SystemC include and systemc.lib file.
There are issues with building current SystemC 2.3.1 in Visual Studio 2015. http://forums.accellera.org/topic/5026-microsoft-visual-studio-community-2015/
VS2013 works fine.
I am trying to use mciSendString in visual studio express 2013 (Visual C++) but I keep getting an error
Error 1 error C3861: 'mciSendStringA': identifier not found
I assume this i because I have not linked to the correct dll, but I cannot find any details online or on msdn about how to link to the dll. It seems quite strange that there wouldn't be more obvious documentation about this. Can someone tell me how to link to the dll?
EDIT:
Here is the code I am trying to run:
#include <Windows.h>
#include <iostream>
#include <mmsystem.h>
extern char command1[] = "open C:\\boing.mp3 type MPEGVideo alias 0";
extern char command2[] = "play 0 from 0";
int main()
{
mciSendStringA(command1, NULL, 0, 0);
mciSendStringA(command2, NULL, 0, 0);
}
To make mciSendString() to work, you need to link to winmm.lib.
Just adding winmm.lib to Project Properties > Linker > Input > Additional Dependencies will be fine.
Looking at mmsystem.h (admittedly from the V7.1A Windows SDK, which is the most recent I have installed), I can see that there's a #ifdef _WIN32 block in there. If _WIN32 is not defined, then mciSendStringA is not declared. Instead mciSendString is declared.
Check your project options and ensure that both WIN32 and _WIN32 are defined. I'm guessing that you started from a console project, rather than a Windows Application project, and that at least one of those isn't defined.
Following code works in Windows XP and Windows 7, but not in Windows 8.
I can get the file path and open in XP and 7. But when I try to open in windows 8 it doesn't work. Why ? any idea ? Thanks.
int main(int argc, char** argv)
{
if (argc == 2)
{
if(OpenFile(argv[1], false))
cout<<"\nFile has been opened successfully."<<endl;
}
return 1;
}
I have solved the issue.. The issue was with FLTK argument pass. I have ignored it and created a simple argument as I mention above at beginning of the main function.
I have tried both VS2010 and VS2008. In the process of trying to configure OpenCV with GPU, I have successfully compiled CUDA codes and OpenCV samples codes seperately.
But when I include the OpenCV libraries in my CUDA environment it doesn't work. The latest problem is when I compile my sample code I get the following exception:
First-chance exception at 0x7c812aeb in test.exe: Microsoft C++
exception: cv::Exception at memory location 0x0011fb18
My code is
/*this is the sample code in opencv website*/
#include "iostream.h"
#include "opencv2/opencv.hpp"
#include "opencv2/gpu/gpu.hpp"
int main (int argc, char* argv[])
{
try
{
cv::Mat src_host = cv::imread("file.png", CV_LOAD_IMAGE_GRAYSCALE);
cv::gpu::GpuMat dst, src;
src.upload(src_host);
cv::gpu::threshold(src, dst, 128.0, 255.0, CV_THRESH_BINARY);
cv::Mat result_host = dst;
cv::imshow("Result", result_host);
cv::waitKey(27);
}
catch(const cv::Exception& ex)
{
std::cout << "Error: " << ex.what() << std::endl;
}
return 0;
}
Any help will be appreciated.
DOn't look at the error box that pops up - look at the console window. OpenCV has error messages that are slightly more descriptive. Tell us what the console says.
I had a similar problem with this same code. I fixed it by
copying opencv_core243d.dll from E:\opencv\build\gpu\x64\vc10\lib folder to the work directory with the .exe.
Don't know why that should matter but it did.
Using cuda 5.0
VS2010 express
win 7 x64
Anyone who might end up here by reference from a google search or similar check out this thread. It may help: OpenCV 2.4.3rc and CUDA 4.2: "OpenCV Error: No GPU support"