Hey there,
I'm trying to use the SetSuspendState() function to hibernate the computer, but I have no idea what parameters I should send to it. The prototype is "BOOLEAN WINAPI SetSuspendState(BOOLEAN, BOOLEAN, BOOLEAN);"
Since I'm a somewhat beginner in c++ programming, I don't really have an idea what BOOLEAN means and what I should send as a BOOLEAN. I tried the "true" and "false", numbers and variables, but none worked.
The compiler error is as follows:
[Linker error] undefined reference to `SetSuspendState@12'
By the way -- I'm using Dev-C++
I checked about SetSuspendState() in DaniWeb, and googled it, but came up with nothing.
Thanks in advance to the helpers!

I checked about SetSuspendState() in DaniWeb, and googled it, but came up with nothing.
Thanks in advance to the helpers!

Are you sure you googled it? There's about a billion relevant hits on 'setsupendstate'.

from the horses mouth:

BOOLEAN is true/false (1/0).

The linker error you got (couldn't find xxx) is because you haven't included the powerprof.a library in your project. Go to project options, parameters, add library or object, find libpowrprof.a. Will work after that.

I don't have the option to choose "project options", since it's not in a project.
Is there a way I can do it not in a project?

Now I get this error:
"26 E:\C++_programs\Makefile.win [Build Error] *** target pattern contains no `%'. Stop. "
(after making it a project and including the said file)

Let me have a look in my crystal ball....

I think you have an error on line 26, and it probably has something to do with a '%' ....

In other words: post the code

You must need new glasses :)
#include<iostream> //cout and cin 
#include<conio.h> //getch()
#include <cstdlib>
#include<PowrProf.h> //SetSuspendState()

using namespace std;
int main(int argc, char *argv[])
return 0;

The error points line 26 in another file, named Makefile.win
Here's that line:
$(BIN): $(OBJ)

$(BIN): $(OBJ)

Those macros are defined elsewhere in the makefile, and that line shows very little information about your specific problem. Post the whole makefile.

# Project: Project2
# Makefile created by Dev-C++

CPP  = g++.exe -D__DEBUG__
CC   = gcc.exe -D__DEBUG__
WINDRES = windres.exe
RES  = 
OBJ  = "C:/Documents\ and\ Settings/U1/Desktop/main.o" $(RES)
LINKOBJ  = "C:/Documents and Settings/U1/Desktop/main.o" $(RES)
LIBS =  -L"C:/Dev-Cpp/lib" C:/Dev-Cpp/lib/libpowrprof.a  -g3 
INCS =  -I"C:/Dev-Cpp/include" 
CXXINCS =  -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include"  -I"C:/Dev-Cpp/include/c++/3.4.2/backward"  -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32"  -I"C:/Dev-Cpp/include/c++/3.4.2"  -I"C:/Dev-Cpp/include" 
BIN  = Project2.exe
CFLAGS = $(INCS)   -g3
RM = rm -f

.PHONY: all all-before all-after clean clean-custom

all: all-before Project2.exe all-after

clean: clean-custom
	${RM} $(OBJ) $(BIN)

$(BIN): $(OBJ)
	$(CPP) $(LINKOBJ) -o "Project2.exe" $(LIBS)

"C:/Documents\ and\ Settings/U1/Desktop/main.o": C:/Documents\ and\ Settings/U1/Desktop/main.cpp
	$(CPP) -c "C:/Documents and Settings/U1/Desktop/main.cpp" -o "C:/Documents and Settings/U1/Desktop/main.o" $(CXXFLAGS)

"move your project to a folder that does not contain spaces, such as c:\dev-c++\source"

Thanks! I didn't think it'll make a trouble to create it on the desktop. It works great now!
You deserve a reputation point from me :P
Thanks again!

The project compiles when source is on the desktop and project is somewhere else.

Have you determined whether there's more than 1 gcc compiler present yet?

You can always uninstall dev-c++, and reinstall it. To check for another gcc: uninstall dev-c++, from the command prompt run "gcc" - if something runs, then gcc is present.

This question has already been answered. Start a new discussion instead.