I am writing a program that requires me to call certain dos commands. I am using the system function like:

system("attrib -h");

when I try to compile it I get

error C3861: 'system': identifier not found

I am using vs2008

any ideas did the command change??

Recommended Answers

All 6 Replies

Be sure to include <cstdlib>.

these are all the includes I have

#include "stdafx.h"
#include <string.h>
#include "CameraWinService.h"
#include <string>
#include <iostream>
#include <fstream>
#include <windows.h>
#include <stdlib.h>
#include <cstdlib>

and it still does not work

Post a small example program that exhibits the problem.

Is system part of the standard namespace? std::system()?

>Is system part of the standard namespace?
Yes, but only in <cstdlib>. The OP seems to be including <stdlib.h> as well, which places system in the global namespace.

Attached is a ping function that I am having the same problem with.

void PingFunction()
		{
			String^ ip = "10.0.0.2";
			int tw0 = 2;

			system("ping ip");
				
		}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.